Calling a macro to run from an external batch file.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Is it possible to cause an existing macro within an access database to run by somehow calling it from an external batch file irrespective of the database being open or not. Any help on how to do this would be greatly appreciated. Thanks
 
Here is a previous Post. I have not used it

This following sample demonstrates how you can execute an
Access macro from another application or database using
OLE automation.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>
*** Resolution *** Dec 9 1999 2:50PM tammyd

1. Create an Access database called C:\TestMacro.mdb
2. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro database"
3. Create another Access database C:TestMacro2.mdb
4. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro2 database"
5. In the application you choose, create a reference to the
Access 8.0
Object
Library
6. Create the following sub procedure:
Sub RunMacroX()

Dim objACC As New Access.Application


Set objACC = GetObject("D:\TestMacro.mdb") 'open first database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = GetObject("D:\TestMacro2.mdb") 'open second
database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = Nothing

End Sub

Jim
-----Original Message-----
Hi,
Is it possible to cause an existing macro within an access
database to run by somehow calling it from an external
batch file irrespective of the database being open or not.
Any help on how to do this would be greatly appreciated. Thanks
 
Back
Top