VBA To Fetch Html URL From Webpage
I have created Macro which can read all the HTML of provided URL, however I want to fetch all the url from that HTML. Sub GetHTML_Click() Dim ie As InternetExplorer Dim html A
Solution 1:
Try this :
Dim ie As Object
Dim html As Object
Dim j As Integer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
URL = "google.com"
ie.Navigate URL
Do While ie.ReadyState <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to website ..."
Loop
Application.StatusBar = " "
Set html = ie.Document
'Dim htmltext As Collection
Dim htmlElements As Object
Dim htmlElement As Object
Set htmlElements = html.getElementsByTagName("*")
For Each htmlElement In htmlElements
If htmlElement.getAttribute("href") <> "" Then Debug.Print htmlElement.getAttribute("href")
Next
Post a Comment for "VBA To Fetch Html URL From Webpage"