Macro to Open a Website from Excel

Add to Favorites
Author:

How to open a website in the browser from Excel using a Macro and VBA.

This is the same as following a link or clicking a link from the worksheet except that it will be done through a Macro.

This does not open a website within Excel. Everything will still open in the browser.

The Macro

Here is the full macro that you need:

Sub Go_to_Website()

Dim ie As Object

 

Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")

 

ie.NAVIGATE "http://www.google.com"

 

ie.Visible = True

 

While ie.busy

 DoEvents

Wend

 

End Sub

This is a simple macro and it will open the website into Internet Explorer by default.

To use the macro, change http://www.google.com to whatever website you want the user to visit.

You can also replace this with a variable that holds the website url in order to make this a bit more versatile. In that case, you would just replace "http://www.google.com" with the desired variable name and without the double quotation marks around the variable name.

This is a fairly simple macro and you should not need to change anything other than what I just mentioned.

If you don't know how to put this macro into Excel, you can read this tutorial here: Install a Macro into Excel

Make sure to download the sample file attached to this tutorial so you can get the macro ready to go in Excel.


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Open any Program from Excel
Macro: This free excel macro allows you to open any program on your computer from excel. You...
Login to a Website using a Macro
: Connect and login to a website using a macro in Excel. This allows you to open a website a...
Open Microsoft Outlook from Excel
Macro: This free macro will open the Microsoft Outlook program on your computer. You do need...
Open Microsoft Word from Excel
Macro: This free macro will open the Microsoft Word program on your computer. You do need to have...
Open Microsoft PowerPoint from Excel
Macro: This free macro will open the Microsoft PowerPoint program on your computer. You do need t...
Make Users Enable Macros in Order to View a Workbook in Excel
Tutorial: Tutorial showing you how to make a user enable macros in a workbook in order to view the w...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course