the code below will get all the hyperlink elements.
Function hyperlinkInformation()
Dim IE As Object
Dim doc, element
Set IE = CreateObject(“InternetExplorer.Application”)
IE.Navigate “http://www.google.com“
Set doc = IE.Document
Dim i As Integer
i = 1
For Each element In doc.all.tags(“A”)
MsgBox = element.innertext ‘prints the text of the hyperlink
MsgBox = element ‘prints the hyperlink itself
‘press ctrl-g to see debug window
i = i + 1
Next element
End Function
The following code will get all the hyperlink controls on html document printed on the activesheet if run through ms excel.
Function hyperlinkInformation()
Dim IE As Object
Dim doc, element
Set IE = CreateObject(“InternetExplorer.Application”)
IE.Navigate “http://www.google.com“
Set doc = IE.Document
Dim i As Integer
i = 1
For Each element In doc.all.tags(“A”)
Cells(i, 1) = element.innertext ‘prints the text of the hyperlink
Cells(i, 2) = element ‘prints the hyperlink itself
‘press ctrl-g to see debug window
i = i + 1
Next element
End Function
Contents of this Site « Selva’s Blog said
[...] Hyperlink Elements in HTML [...]