How to open a website with vba

Updated July 20, 2017

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.

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

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

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

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

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

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

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.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Keith Perry has been an employee and contractor for several large companies in various information-technology jobs. He holds an executive Master of Business Administration from Jacksonville University with an undergraduate degree in computer science from University of North Florida. He began writing for Lotus Notes Advisor and Mobile Advisor publications in 1998.