October 30, 2021

Open FireFox and Google Chrome with VBA

How to open Firefox and Google Chrome with Excel VBA. Watch the video below:

Using FireFox and Google Chrome with Excel VBA

We may need to fire up browsers like Firefox and Google Chrome via Excel VBA because these are the only web browsers allowed in some companies. The code below helps us to automatically open Firefox and Google Chrome automatically to perform further actions. In the process we also learn some more interesting macro coding in Excel.

Option Explicit

Sub StartFireFoxAndChrome()

VBA.Shell “Explorer.exe C:\Program Files (x86)\Mozilla Firefox\firefox.exe”, vbMaximizedFocus

Application.Wait Now + TimeValue(“00:00:10”)

SendKeys “copy data from sheet1 to sheet2”

Application.Wait Now + TimeValue(“00:00:02”)

SendKeys “~”

Application.Wait Now + TimeValue(“00:00:05”)

SendKeys “%{F4}”

Application.Wait Now + TimeValue(“00:00:02”)

VBA.Shell “Explorer.exe C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”, vbMaximizedFocus

Application.Wait Now + TimeValue(“00:00:05”)

SendKeys “copy data from sheet1 to sheet2”
Application.Wait Now + TimeValue(“00:00:01”)

SendKeys “~”

End Sub

Open FireFox and Google Chrome with VBA
Open FireFox and Google Chrome with VBA

Further reading on SendKeys Statement

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.