active a macro from a different database while working in another

  • Thread starter Thread starter Guest
  • Start date Start date
Hi

Create a new button and use something like this OnClick

Private Sub ButtonName_Click()
On Error GoTo ButtonName_Click_Err
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\SomeFolder\DataBaseName.mdb""/XMacroName", 1)
ButtonName_Click_Exit:
Exit Sub
ButtonName_Click_Err:
MsgBox Error$
Resume ButtonName_Click_Exit
End Sub


Note
ButtonName
This is the button name that you have just made

C:\SomeFolder\DataBaseName.mdb
This is the path to new DB (of course it will be different on your DB). If
you don't know the path use
Start -
Run -
Browse -
Browse to your new DB and then select it. When you get back to the run box
simply cut the path (contol X) and then paste (control V) it into the above
code.

XMacroName
This is the name of the macro in th new DB. You must leave the X in place
just before the macro name.

Hope this helps
 
Back
Top