Macro to Open a Website from Excel

Add to Favorites

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

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...
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 ...
Open a Word Document from Excel
Macro: This Microsoft Excel macro will open a Microsoft Word document from excel. With this m...
Tutorial Details
Downloadable Files: Excel File
Similar Content
Open any Program from Excel
Macro: This free excel macro allows you to open any program on your computer from excel. You...
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...
Excel Forum