Running Excel Sub from Access

Climbo

Registered User.
Local time
Today, 18:22
Joined
May 7, 2008
Messages
16
Hello there,

From Access, I want to open an excel sheet and run a sub (which is activated by a button in excel). The sheet opens without a problem but seems that I'm unable to have the Sub run (Access 11.0 object library checked). I always get "The macro 'UpdateReport_Click' cannot be found.

Code:
Set objXL = CreateObject("Excel.Application")
Set xlWB = objXL.Workbooks.Open(LastFileName)
 
objXL.Visible = True
objXL.Application.Run "UpdateReport_Click"
 
Already tried this variant, getting same error :(
 
The name sounds more like a click event associated with a button on the userform.

Try something like

Code:
objXL.UserFormName.UpdateReport_Click
 

Users who are viewing this thread

Back
Top Bottom