So I'm totally at a loss as to the issue here and for once can't find the answer already on here.
I have an access database that calls a sub in excel and runs it perfectly. Then it flicks back to access, asks a question and then, depending upon the answer of that, should call a second sub in the same excel spreadsheet that was already open. Both subs in excel are 'public' and both sit under "thisworkbook' and I definitely have the name of the second sub correct. Access code is below. (xlApp is earlier defined by
Set xlApp = CreateObject("Excel.Application")
I get run-time error 424 "object required" when i hit the second .run MacroName line. Thanks
With xlApp
.Visible = True
.Workbooks.Open progsPathName & "excel_for_plots.xlsm"
MacroName = .ActiveWorkbook.Name & "!" & "ThisWorkbook.do_the_country_stuff"
.Run MacroName
' check the labels
m = MsgBox("Are the labels ok?", vbYesNo, "Label positions")
If m = vbNo Then
MacroName = .ActiveWorkbook.Name & "!" & "ThisWorkbook.first_check"
.Run MacroName
End If
End With
I have tried checking the sub names, checking they are public, calling the sub something different, using the immediate window to check the 2 MacroName strings are the same except for the sub names. Always get the same error :(