Try this code:
Dim objAcc As Access.Application
Set objAcc = New Access.Application
With objAcc
.OpenCurrentDatabase "C:\Accessdb.mdb"
.DoCmd.RunMacro ("runmac")
.CloseCurrentDatabase
.Quit
End With
Set objAcc = Nothing
If you get any error message then go to VB Editor, go to Tools > References and check the box beside Microsoft Access X.X Object Library (the X.X represents whatever version number you have).
|