Thread: vba error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default vba error

JT,

In Excel, you would use this to run a macro from another workbook:

Application.Run "'Workbook Name.xls'!Macro_Name"

so, and I'm just guessing here, something along the lines of

AppAcc.DoCmd.RunMacro "'" & vName & "'!Import_AR_Data"

You might want to post in an Access group....

HTH,
Bernie
MS Excel MVP


"JT" wrote in message
...
I am opening an Access Database from Excel.....so far no problem.......once I
get the database opened.....I want the macro to run a macro I have stored in
Access.

Here is the code I'm using:

Set AppAcc = New Access.Application
AppAcc.Visible = True
AppAcc.OpenCurrentDatabase vName

AppAcc.DoCmd.RunMacro ("Import_AR_Data")

When the macro gets to this last line of code, I get the following message:

Microsoft Office Access can't find the macro 'Import_AR_Data'

(This Access macro will run several queries in vba from Access)

It is in the database in a module called "Import_ARs"

Any suggestions on what I am doing wrong would be greatly appreciated.
Thanks for all of the help.

--
JT