active a macro from a different database while working in another

  • Thread starter sierralightfoot
  • Start date
S

sierralightfoot

While working in one database I want to run a macro from a different database.
 
W

Wayne-I-M

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top