Open links in Chrome instead of default IE

wsammy

New Member
Joined
Jun 7, 2016
Messages
2
All but one of my internet-based programs at work only function in Chrome. I have to keep my default as IE for the one program. I need the links in excel to open in Chrome. This is what I have, but it is not working. Where have I gone wrong? This is not for a specific URL, but any URLs opened in excel.

Sub showURL(browser As String, URL As String)
Dim pPath As String
Dim bPath As String


pPath = Environ("ProgramFiles")


If browser = "IE" Then
bPath = pPath & "\Internet Explorer\iexplore.exe"
ElseIf browser = "Chrome" Then
bPath = pPath & "\Chrome\chrome.exe"
Else
Exit Sub
End If


Call Shell(bPath & " " & URL, vbNormalFocus)
End Sub
Sub Testing()
Call showURL("IE", "http://www.tips.net")
Call showURL("Chrome", "http://excel.tips.net")
End Sub


Private Sub Workbook_Open()


End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Change this line:
Code:
bPath = pPath & "\Chrome\chrome.exe
"

to
Code:
bPath = pPath & "\Google\Chrome\Application\chrome.exe"
 
Upvote 0
Change this line:
Code:
bPath = pPath & "\Chrome\chrome.exe
"

to
Code:
bPath = pPath & "\Google\Chrome\Application\chrome.exe"


Thank you for replying. That did not seem to fix my issue. It is still directing to IE. Here is the newest version:

Sub showURL(browser As String, URL As String)
Dim pPath As String
Dim bPath As String

pPath = Environ("ProgramFiles")

If browser = "IE" Then
bPath = pPath & "\Internet Explorer\iexplore.exe"
ElseIf browser = "Chrome" Then
bPath = pPath & "\Google\Chrome\Application\chrome.exe"
Else
Exit Sub
End If

Call Shell(bPath & " " & URL, vbNormalFocus)
End Sub

Sub Testing()
Call showURL("IE", "http://www.tips.net")
Call showURL("Chrome", "http://excel.tips.net")
End Sub

Private Sub Workbook_Open()


End Sub
 
Upvote 0
All but one of my internet-based programs at work only function in Chrome. I have to keep my default as IE for the one program. I need the links in excel to open in Chrome. This is what I have, but it is not working. Where have I gone wrong? This is not for a specific URL, but any URLs opened in excel.

Sub showURL(browser As String, URL As String)
Dim pPath As String
Dim bPath As String


pPath = Environ("ProgramFiles")


If browser = "IE" Then
bPath = pPath & "\Internet Explorer\iexplore.exe"
ElseIf browser = "Chrome" Then
bPath = pPath & "\Chrome\chrome.exe"
Else
Exit Sub
End If


Call Shell(bPath & " " & URL, vbNormalFocus)
End Sub
Sub Testing()
Call showURL("IE", "http://www.tips.net")
Call showURL("Chrome", "http://excel.tips.net")
End Sub


Private Sub Workbook_Open()


End Sub
Worked for me. Thank you!
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,407
Members
449,448
Latest member
Andrew Slatter

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