Automate Chrome from Excel VBA using Selenium

Опубликовано: 05 Март 2025
на канале: OfficeTricks
2,475
16

Learn how to Install Selenium in Windows PC & initiate Chrome browser using Chromedriver.exe from Excel VBA Macro.

From Excel, you can learn to open a Chrome browser and navigate to any website.
How to Automate Chrome browser with Excel - VBA & Selenium?

----------- In Detail ------------ #
1. Download & Install SeleniumBasic
https://github.com/florentbr/Selenium...

2. Check version of your Google Chrome Browser
-- Sample: Version 91.0.4472.77 - Official Build 64-bit

3. Download Chromedriver compatible with above version of Chrome
https://sites.google.com/a/chromium.o...

4. Extract Chromedriver.exe from Zip file downloaded from above path & Replace the chromedriver.exe in below path.
C:\Users\%username%\AppData\Local\SeleniumBasic

5. Include reference to Selenium in Excel VBA editor.
Tools - References - Selenium Type Library

6. Try this test program:
Sub InitBrowser()
Dim oChrome As New Chromedriver
oChrome.SetProfile "C:\Users\" & getUserName & "\AppData\Local\Google\Chrome\User Data\Default"
oChrome.Start "chrome", "https://www.google.com"
oChrome.Get "/"
End Sub