Hello there,
I am trying to run an excel macro through access and always getting a runtime 1004-Macro cannot be found error... anyone can help? here is part of my code:
and my .bas file:
I am trying to run an excel macro through access and always getting a runtime 1004-Macro cannot be found error... anyone can help? here is part of my code:
Code:
FileDirectory = "J:\RC Tools\Vendor Bins Report"
Set objXL = CreateObject("Excel.Application")
Set xlWB = objXL.Workbooks.Open(LastFileName)
Set xlWS = xlWB.Worksheets("Agent Level Report")
objXL.VBE.ActiveVBProject.VBComponents.Import FileDirectory & "\GenerateNewData.bas"
[B]objXL.Run "GenerateNewData" <--- error is here
[/B]
and my .bas file:
Code:
Attribute VB_Name = "GenerateNewDataMacro"
public Sub GenerateNewData()
...
...
end sub