Run a MS Access Subroutine from Excel

G

Guest

I'm trying to execute a Subroutine located within the an Access database.
But I get the error "Microsoft Access can't find the procedure
'ModuleName.mySub' " when the "acApp.Application.Run" statement is executed.

Dim acApp As Access.Application
Set acApp = CreateObject("Access.Application")
acApp.Application.Visible = True
acApp.OpenCurrentDatabase "C:\Access DB\myDB.mdb", True
acApp.Application.Run ("'ModuleName.mySub")

mySub is declared as Public.

Any suggestions?

Thanks, Mark
 
M

Marshall Barton

Mark said:
I'm trying to execute a Subroutine located within the an Access database.
But I get the error "Microsoft Access can't find the procedure
'ModuleName.mySub' " when the "acApp.Application.Run" statement is executed.

Dim acApp As Access.Application
Set acApp = CreateObject("Access.Application")
acApp.Application.Visible = True
acApp.OpenCurrentDatabase "C:\Access DB\myDB.mdb", True
acApp.Application.Run ("'ModuleName.mySub")

mySub is declared as Public.


Maybe it's just a typo, but you have an extraneous
apostrophe in there. Also, drop the parenthesis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top