question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Class not registered" when running a (working) SeleniumBasic VBA macro from a VBScript and Task Scheduler

See original GitHub issue

I have a VBA macro using SeleniumBasic that runs >perfectly< from a command button in Excel 2019. I need this macro running from the Windows 10’s Task Scheduler and when calling the same macro from a VBScript within Task Scheduler it produces a run time error “Class not registered” at this line:

Set MyDriver = New Selenium.ChromeDriver

This is the script I’m using with the Task Scheduler:

Dim ObjExcelApp Dim ObjWorkbook Set ObjExcelApp = CreateObject("excel.application") Set ObjWorkbook = ObjExcelApp.Workbooks.Open("C:\SeleniumBasic_Test\WorkbooWithMacro.xlsm") ObjExcelApp.Run "TestSeleniumBasic" ObjWorkbook.Close False ObjExcelApp.Quit Set ObjExcelApp = Nothing

Nothing fancy here, just calling the Public Sub TestSeleniumBasic().

I tested the macro with .EdgeDriver and got the same “Class not registered” error. Again, the macro runs without issues from Excel.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
rufogilcommented, Jan 17, 2022

Hi rufo, looks like the problem could be related to the fact that you are controlling excel externally but i may be wrong. Try runing everything with admin privileges at first if that doesnt work try declaring the driver inside your module but outside the sub.

Dim MyDriver As New Selenium.Chromedriver

Public sub testseleniumbasic()

MyDriver.start

’ Run your test here

End sub

I did this test. Same “Class not registered” result. Thanks!.

I am having the exact same issue. I believe there was a .net update released from Microsoft which screwed something up. The problem keeps popping up from the Task Scheduler. Any help on this will be greatly appreciated.

Is it a VBA bug?. Classes ChromeDriver and EdgeDriver are registered. Yesterday I was preparing a new workbook with a tiny SeleniumBasic macro to reproduce the problem and show its code here and it ran without issues from the VBScript and the Task Scheduler!. As a test, I opened a totally new workbook and copied there the strictly necessary to run my original SeleniumBasic “buggy” macro, and for my surprise it fully ran. I didn’t drag and drop the modules, instead, I created the modules manually from zero and I copied and pasted their code as text. Today I’m planning to uncheck the other libraries references I’m using to see the results… But at this point, I’m just randomly “shooting arrows”… Thanks!.

1reaction
Gby3commented, Jan 13, 2022

Hi rufo, looks like the problem could be related to the fact that you are controlling excel externally but i may be wrong. Try runing everything with admin privileges at first if that doesnt work try declaring the driver inside your module but outside the sub.

Dim MyDriver As New Selenium.Chromedriver

Public sub testseleniumbasic()

MyDriver.start

’ Run your test here

End sub

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Class not registered" when running a (working) ...
I have a VBA macro using SeleniumBasic that runs >perfectly< from a command button in Excel 2019. I need this macro running from...
Read more >
Excel VBA Office 2019 Class not Registered Run time Error ...
Hi. I have a macro that used to run fine and now gives me the error message as shown below. I need to...
Read more >
Class not registered | MrExcel Message Board
I am running the task. Yes. The task scheduler essentially opens the excel workbook. Vba takes it from there.
Read more >
Class Not Registered VBA Error: How to Fix It [Excel]
One such is the Class not registered VBA error in Microsoft Excel. ... Press Windows + R to launch the Run command, type...
Read more >
Fix Class not registered VBA Run-time error
Open Excel and click on Options. · Switch to the Trust Center tab. · Click the Trust Center Settings button. · Go to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found