write at exceltoexplore@gmail.com : Report Automation|Dashboard in Excel| Provide Excel consulting through macro (VBA) automation |Financial Modeling | Ethical Hacking

Friday 10 February 2012

Excel : Open list of website & download data

this requirement came from my friend. He used to open list of websites & download the NAV.
you can download data from web page through web query


Sub Mtest()
Dim page As New InternetExplorer
For i = 2 To Sheets("websitelist").Range("A" & Rows.Count).End(xlUp).Row
URL = Sheets("websitelist").Cells(i, 1)
page.Navigate URL '
page.Visible = True
Do
Loop Until page.ReadyState = READYSTATE_COMPLETE
page.Refresh
'=============================
'call your web query here
'=============================
page.Quit
'if you dont use below line you will get error like
'The remote server machine does not exist or is unavailable
'This quits page and releases the object.
Set page = Nothing
Next i
End Sub

No comments:

Post a Comment