From Excel, I need to open an Access database and run one of the database's macros.
I'm using Excel and Access 2007. Here is my code in Excel:
Sub accessMacro()
Dim appAccess As New Access.Application
Set appAccess = Access.Application
appAccess.OpenCurrentDatabase "C:\blah.mdb"
appAccess.Visible = True
appAccess.DoCmd.RunMacro "RunQueries.RunQueries"
appAccess.CloseCurrentDatabase
End Sub
In the Access database, there is a procedure named RunQueries in a module named RunQueries.
I get:
Runtime error '2485':
Microsoft Access Office can't find the object 'RunQueries.'
I also tried
appAccess.DoCmd.RunMacro "RunQueries"
and I get the same errors message.
I argued against it, and I have to do it this way (meaning, I have to use Excel as a frontend to open several Access dbs and run their macros).