run an Excel macro from Access : Run time error 1004

  • Thread starter intersection row and column
  • Start date
I

intersection row and column

I try to run an Excel Macro from Access and I get the following error message :
Run-time error '1004'
The macro 'macros ARC.XLS!importer_from_Researchtool' cannot be found

any idea what the problem is ???

this is the code in VBA Access :

Dim xls As Object, xwkb As Object
Dim strFile As String, strMacro As String
strFile = "macros ARC.XLS"
Set xls = CreateObject("Excel.Application")
xls.Visible = True
Set xwkb = xls.Workbooks.Open(thePath & strFile)

strMacro = "importer_from_Researchtool"
xls.Run strFile & "!" & strMacro, theYear, week
 
D

Danny Seager

How about trying

Dim strPath As String
Dim xlApp As Object
Dim xlSheet As Object
strPath = "C:\macros ARC.XLS"
Set xlApp = CreateObject("Excel.Application")
Set xlSheet = xlApp.workbooks.Open(strPath).Sheets(1)
With xlApp
..Run "importer_from_Researchtool"
End With

Note I specify the path of the excel file in my code so you might need to
change that
 

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