How to open a website with vba

Written by keith perry
  • Share
  • Tweet
  • Share
  • Email

Visual Basic for Applications is the programming language provided with many Microsoft products such as Excel, Word and Visio. VBA is a robust programming language with a wide range of methods and functions. Opening a website from inside of an application like Excel is becoming more commonplace as the quantity of information stored in websites continues to grow. A practical use of opening a website from within an Excel spreadsheet would be to allow the user to view additional help information located on a webpage that pertains to that particular spreadsheet.

Skill level:
Moderately Easy


  1. 1

    Open the Microsoft Excel application from the "Start" button located on the Windows menu bar.

  2. 2

    Open the macro menu by pressing the "Alt" and "F8" keys.

  3. 3

    Enter "Browser" into the Macro name box and click on the "Create" button.

  4. 4

    Paste the following code directly below the text "Browser":

     Dim urlData As String
    Set Browser = CreateObject("InternetExplorer.Application")
    urlData = InputBox("Please enter URL")
     Browser.Navigate (urlData)
     Browser.Visible = True
  5. 5

    Save the macro by pressing the "Ctrl" and "S" keys. Close the window titled "Microsoft Visual Basic" to return to the Excel application.

  6. 6

    Open the macro menu by pressing the "Alt" and "F8" keys. Select the macro "Browser" and click on the button labelled "Run."

  7. 7

    Enter the website to which you wish to navigate in the pop up box with the text "Please enter URL." Click on the button labelled "OK" and the website will display in a new Internet Explorer browser.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.