Run-Time Error in Call to Macro from Form

AlexB123

Board Regular
Joined
Dec 19, 2014
Messages
207
Hello all,

I updated a macro that had been created by a previous resource, and now when I call the macro in my Access DB I am receiving a "Run-time error '438': Object doesn't support this property or method'.

I'm confused because I use the same late-binding references in all my forms. Also, I checked the name of the macro and the path of the macro for obvious errors and found none.

Code:
Dim xlApp As Object
Dim xlWB As Object
Set xlApp = CreateObject("Excel.Application")
Set xlWB = xlApp.Workbooks.Open("C:\Users\Alex\DB\UploadMacro.xlsm"): DoEvents
xlApp.Visible = True
xlWB.Run "OCRMacro"
xlApp.Quit
Set xlApp = Nothing
Set xlWB = Nothing

What could cause this error? Where should I look to find simple bugs? Is there an issue with my code?

Any help is appreciated; if needed, I am happy to provide more information.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Have you had a recent windows update?

I'd walk through it line by line in the debug window.

Even try putting DoEvents on it's own line?
 
Upvote 0
I tried stepping through every line in the sub, and also tried the DoEvents on its own line.

All I can find is that the UploadMacro is "Read-Only" when it opens on my computer in break mode??? Could that be it?
 
Upvote 0
I just changed xlWB.Run to xlApp.Run ... which worked ... but I'm a bit worried it may cause an error?

Why would that change work? None of my other subs have run into this problem.

FYI - I have been dealing with lots of Windows updates lately. But almost every problem I've come across due to updates I have been able to address by re-writing code and updating references to objects.
 
Upvote 0
To my knowledge, the application has a Run method and the workbook does not ... so it's not why did it work before and now it's broken, but why wasn't it broken before!
 
Upvote 0
I'm aware from another forum that the 1803 update broke a few things that worked fine previously, which is why I asked about it.
Perhaps they are just tightening up their code?
 
Upvote 0
I'm aware from another forum that the 1803 update broke a few things that worked fine previously, which is why I asked about it.
Perhaps they are just tightening up their code?

I assume you are correct ... as I am currently rewriting many macros due to general updates of user OS's to Windows 10. I am amazed that their code worked for so long!

After I thought about xenou's comment, I realized I have had to change a few of the form subs where I have run into this problem intermittently. So it appears I've got to go through all my code and update every similar reference today.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top