Open an Access database and run one of its Macros from Excel
- by sqlnoob
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.  Each time I run this, I get the following error:
Runtime error '2485':
Microsoft Access Office can't find the object 'RunQueries.'
I have also tried:
appAccess.DoCmd.RunMacro "RunQueries" 
and I get the same errors message.  Any idea how to do this?  By the way, I could go into a long explanation about why I need to do this, but let me just say that I've already 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).