Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Specifying a Browser in a Hyperlink.

Specifying a Browser in a Hyperlink

Written by Allen Wyatt (last updated June 1, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


3

Laura wants to include a hyperlink in a worksheet. However, she would like the hyperlink to "force" the target of the URL to be displayed in a particular browser. For instance, she would like the hyperlink to somehow specify that the target be opened in Internet Explorer.

There is no way to do this within Excel; a hyperlink in a worksheet, when clicked, relies on whatever the default browser is on the system being used. There is a workaround that you can try, however: You could create a macro that actually opens a target address using a specific browser.

For example, consider the following macro. It automatically opens an instance of Internet Explorer and opens a website in that browser:

Sub LaunchIE()
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate "http://excel.tips.net/"
    IE.Visible = True
    Set IE = Nothing
End Sub

The macro could easily be assigned to a shortcut key. It isn't terribly flexible, however, when it comes to which browser is being used (it is always Internet Explorer) and which site is displayed (it is always the ExcelTips site). You can make it a bit more flexible in this manner:

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

    'Use this to resolve the correct program file path
    'it is different on 32-bit and 64-bit systems
    pPath = Environ("ProgramFiles")

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

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

Note that the main routine—showURL, the one that does all the work—can work with either Internet Explorer or Firefox. The Testing routine shows how to launch the browsers; all you need to do is specify which browser you want and what URL you want to open in that browser.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9836) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Specifying a Browser in a Hyperlink.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Moving Subtotals

When you add subtotals to a worksheet, Excel typically places them in the same column that you are subtotaling. If you ...

Discover More

Changing the Font Size in Combo Boxes

When you add a combo box to a worksheet, Excel makes some assumptions about the best font size to use in the control. ...

Discover More

Indent and Justify Command

WordPerfect users are familiar with the F4 command, which indents and justifies a paragraph. Word does not have an ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Retrieving Web Query Data without Interruption

If you use Excel's Web Query tools to grab data from a website, you may run into some problems if the site isn't ...

Discover More

Specifying Default Hyperlink Text

When you insert into a cell a hyperlink that references a file on your system, the text displayed by default matches the ...

Discover More

Pasting a Hyperlink

Need a quick link within a document to some external data? You can paste information so that Excel treats it just like a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 5 - 3?

2017-03-03 13:53:43

Ross VK

Much like Ken I have an excel sheet of AXIS ip cameras that only work in IE, but Chrome is our default browser. So for each of the 180 cameras listed I have to click on it in Excel, it opens in Chrome, says I need to download quick-time to get site to function, I need to close that window, copy the link from Chrome, paste it into ie and go from there. When we need to view a camera quickly or do an audit of numerous cameras it is not a quick or easy task!


2015-10-23 09:59:12

J. Nygren

You can create a folder somewhere on your system, and then save shortcuts there that display a URL in a particular browser. (For example, in Windows, set the shortcut's Target to something like "C:Program FilesInternet Exploreriexplore.exe" "http://excel.tips.net".) Then put a hyperlink in your worksheet that points to the shortcut.


2015-07-17 10:56:41

Ken

I know this topic is a few months old, but I'm wondering if anything has changed. I have a spreadsheet in MS Excel (2010 version 14.0.7145.5000) that includes a column of hyperlinks (almost 300 rows). Every one of the links, when clicked, opens in my default browser (Chrome), except one, which opens Internet Explorer. I have looked at properties of the hyperlink, and of the cell, and cannot find why it does this - but I want to know because there are certain sites that I have linked that only function properly in IE, and I'd like to set them up to open IE also. Any clues what might be going on here?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.