Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Specifying a Browser in a Hyperlink.

Specifying a Browser in a Hyperlink

Written by Allen Wyatt (last updated September 30, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


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 or to a toolbar button. 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 (9835) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) 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

Pasting a Comment into Your Document

When developing a document, you may end up with all sorts of comments that you need to deal with. One common task is to ...

Discover More

Removing HTML Tags from Text

HTML tags are great when you want to display information on a web page. They are not so great when you have them in a ...

Discover More

Determining a Format's Currency Symbol

Excel allows you to format numeric values in many different ways, including as currency. If you want to determine, in a ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Get Rid of Web Stuff

When you copy information from a Web page and paste it into a worksheet, you can end up with more than you bargained for. ...

Discover More

Setting Web Fonts

Is your worksheet information destined for a Web page? Here's how you can specify the fonts that should be used when ...

Discover More

Specifying Your Target Monitor

When you create a worksheet that is destined for viewing on the Web, you will want to specify the monitor resolution you ...

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 two less than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.