Tuesday, May 26, 2009

How to Open URL list from Excel using Macro

Opening of an URL from Excel and performing some actions in the browser might be a regular activity of some excel users. This article helps in automating a part of this. Say, you have a list (10 or more) of URL links in column A and your requirements are as follows
1. Open up each url link and perform some tasks (code provides a place holder for performing the tasks. Tweak accordingly).
2. Use the same browser window to open the URLs.
3. Close the browser window once all the work is done.

Check the below code to get the desired result.

Code Block

Public Sub OpenURLList()

Dim rowcount As Integer
Dim urlToOpen As String

Set ie = CreateObject("InternetExplorer.Application")
'Show browser
ie.Visible = True
rowcount = 1
Do While Sheets("Sheet1").Range("A" & rowcount) <> ""

urlToOpen = Sheets("Sheet1").Range("A" & rowcount).Value
'Open the links in the same browser
ie.Navigate2 urlToOpen
'Perform your events here
MsgBox urlToOpen & " is open. Check your browser"
rowcount = rowcount + 1


'Close Browser

End Sub

Hope you had fun playing with the URLs and Excel. Let me know your comments.


rpotor October 20, 2009 at 4:36 AM  

This is a very good script, just what I needed. Works as described. Thank you very much!


Recent Comments

  © Blogger template 'Perfection' by Ourblogtemplates.com 2008

Back to TOP