Class not registered

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi

So beyond me this one.
I am getting a runtime error in the below code.

BUT

Only when i open the excel file from a scheduled task in task scheduler.

The code runs just fine if i manually open the file

the macro is called upon workbook open BTW.

Any ideas? thanks.

dave

VBA Code:
Dim mybrowser As Selenium.ChromeDriver
Sub get_ip()
Set mybrowser = New Selenium.ChromeDriver 'error is here
mybrowser.AddArgument "--headless"
mybrowser.Get "https://www.showmyipaddress.eu/"
ip1 = mybrowser.FindElementByXPath("/html/body/div[2]/div/div/div/div[1]/div[1]").Text
'at this point i email myself the ip1.
ThisWorkbook.Save
Application.Quit
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Task is being run on same computer as the one you're using to open manually? If not, seems like
- a reference library is missing from the workbook code project on the other pc, or
- a dll or similar is not installed and/or registered in Windows on it, or
- is stored under a profile/account and isn't available to the account running the task, or
If it is the same pc and account, I have no idea.
 
Upvote 0
Hi micron.

Thanks for your response.

Yes, the task is on the same pc as when I run it manually.

Ohhh. Lol. These things are fun.
 
Upvote 0
But are you the one running the task?
BTW, I'm assuming the error message is reflected in your post title as you didn't actually state what it is.
 
Upvote 0
I am running the task. Yes.

The task scheduler essentially opens the excel workbook. Vba takes it from there.
 
Upvote 0
Run time error.

2147221164(80040154)

Class not registered.

So if I open the excel file. I can run the code. No problem. All works.

If task scheduler opens the excel file the code errors.

Thanks for your help. Although it’s an odd one.
 
Upvote 0
Ok. I found the problem.

On the task scheduler I had to click the setting to

Configure for windows vista windows server 2008.

I had it set to windows 10. Although I am running 10.

Works now.
 
Upvote 0
Solution
Interesting! Thanks for posting a solution.
 
Upvote 0
Thanks for your help.

Always like to post solutions. Maybe will help others. ?
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

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