Run macro in an external access db from current access db

  • Thread starter Thread starter skunjur
  • Start date Start date
S

skunjur

Hi Guys,

Is there a code to run a macro I have in an external database from my
current database. I tried to use the RunMacro method after connecting to the
external database and it wouldn't work.

Here is the code I am using. Any help would be greatly appreciated.

Sham

Set CubeCalcDb = OpenDatabase(FileName)

With CubeCalcDb

DoCmd.RunMacro "003_Calculate_Cube"

End With
 
skunjur said:
Is there a code to run a macro I have in an external database from my
current database. I tried to use the RunMacro method after connecting to the
external database and it wouldn't work.

Here is the code I am using. Any help would be greatly appreciated.

Set CubeCalcDb = OpenDatabase(FileName)

With CubeCalcDb

DoCmd.RunMacro "003_Calculate_Cube"

End With


AFAIK, there is no way to run a macro in another db. In
addition, OpenDatabase does not expose anything in a
database beyond its DAO objects, which does not include
macros or VBA code.

If you convert the macro to a VBA procedure and reference
the other db as a library. Then you can use the procedure
as if it were in your regular db.

For more complex situations, you might need to explore using
Automation.
 
Back
Top