logo
search
VBA & Macro Problems

Fix VBA EdgeDriver Object Variable Not Set in SeleniumBasic

Maira MehtabMaira Mehtab Sep 21, 2026 868 views

Question details

The user is encountering an 'Object variable or With block variable not set' error when attempting to create an EdgeDriver object in Microsoft Access VBA using SeleniumBasic.

Product
VBA / SeleniumBasic
Device & OS
Windows 10
Scenario
Running a VBA script to automate the Microsoft Edge browser with SeleniumBasic after the operating system was reimaged.
Observed behavior
The VBA program fails to instantiate the EdgeDriver object during the 'Dim EDGE As New EdgeDriver' command, resulting in a runtime error.
Before you start

Ensure you have an active internet connection to download the required driver files and know your exact current version of the Microsoft Edge browser.

Solution 1Recommended

Update Microsoft EdgeDriver to Match Browser Version

The most common cause for the EdgeDriver failing to initialize in SeleniumBasic is a version mismatch between the installed Edge browser and the EdgeDriver executable.

When Windows is reimaged or Microsoft Edge automatically updates, the browser version changes. If the EdgeDriver in your SeleniumBasic folder is older or corresponds to a different build, the VBA integration will fail to create the session, throwing the 'Object variable not set' error.

1
Check Edge Browser Version

Open Microsoft Edge. Click the three horizontal dots (Settings and more) in the top right corner. Navigate to 'Help and feedback' > 'About Microsoft Edge' and note the exact version number displayed.

2
Download Matching EdgeDriver

Go to the official Microsoft Edge Developer website (Microsoft Edge WebDriver page). Download the version of the WebDriver that perfectly matches the browser version you noted in the previous step.

3
Extract and Replace Driver

Extract the downloaded ZIP file. Locate the 'msedgedriver.exe' file inside and copy it. Paste and replace the existing file in your SeleniumBasic installation folder (typically located at C:\Users\[Username]\AppData\Local\SeleniumBasic).

4
Restart Application

Close Microsoft Access (or your VBA host application) and reopen it. Run your VBA automation script again to verify that the EdgeDriver object instantiates successfully.

Automation Example: For detailed syntax and Microsoft's official example of automating Edge with SeleniumBasic in VBA, you can consult the Microsoft Learn documentation regarding Edge web automation.
Free Microsoft Office alternative

Looking for a Seamless Office Alternative with Macro Support?

If you frequently work with VBA macros and automation but want a more cost-effective solution, consider trying WPS Office. It provides a robust, built-in VBA environment in WPS Spreadsheets and high compatibility with Microsoft Office file formats.

  1. 1. Download and Install WPS Office: Visit the official WPS website, download the free installer, and complete the quick installation process.
  2. 2. Open Your Macro-Enabled Files: Launch WPS Spreadsheets and open your existing .xlsm or .xlsb files directly without format conversion.
  3. 3. Enable and Run VBA: Navigate to the 'Developer' tab in WPS Spreadsheets to access the VBA Editor and execute your automation scripts.
Fully compatible with Microsoft Excel, Word, and PowerPoint formats (.xlsx, .docx, .pptx).Built-in VBA editor for running existing macros and automation scripts.Lightweight installation and significantly faster startup times.Free to use with comprehensive document editing and formatting features.
microsoft office alternative - wps office

Frequently Asked Questions

Why does SeleniumBasic throw an 'Object variable not set' error?

This error typically occurs when the automation driver (like EdgeDriver) fails to instantiate the browser session. In most cases, this is caused by a version mismatch between your web browser and the WebDriver executable in the SeleniumBasic folder.

Where is the default SeleniumBasic installation folder located?

By default, SeleniumBasic installs to the user's local AppData folder. You can usually find it at 'C:\Users\[YourUsername]\AppData\Local\SeleniumBasic'. This is where you need to place your updated WebDriver executable files.

Can I automate web browsers using VBA in WPS Office?

Yes, WPS Spreadsheets supports Visual Basic for Applications (VBA). You can install SeleniumBasic, reference it in the WPS VBA editor just as you would in Microsoft Office, and run your web automation scripts.

How do I ensure my EdgeDriver doesn't become outdated again?

Because Microsoft Edge updates automatically in the background, your driver will eventually mismatch again. You can either turn off automatic Edge updates (not recommended for security reasons) or implement a WebDriver manager script in your VBA code that dynamically downloads the matching driver version before execution.