Set default browser by vba

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514
Hi All,

I have the below code to login into my gmail account and it is working fine. The problem with this code is it is opening the site in internet explorer but I want to open it in chrome.

Please help how to set the browser with vba code.

Code:
Sub test()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")


IE.Visible = True
IE.Navigate "http://www.gmail.com"


While IE.Busy
  DoEvents  'wait until IE is done loading page.
Wend


IE.Document.all("Email").Value = "sss@gmail.com"
IE.Document.all("Passwd").Value = "abc"
IE.Document.all("signIn").Click


End Sub



Thanks in advance!!

Regards,
Shweta
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hello

This code will open up Gmail in Google Chrome, but will not do the login unless you let Gmail remember your username and password (my preferred way of working).

Code:
Sub test_wigi()

    Shell """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" -url http://www.gmail.com"

End Sub

Change the Google installation path if needed.
 
Upvote 0

Forum statistics

Threads
1,203,513
Messages
6,055,833
Members
444,828
Latest member
StaffordStag

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