samphdauto
Technical User
Hello
I have this code which was given by a programmer. it extracts the LinkText and LinkHref from a WebBrowser.
Could any one help. I need a code to use on Inet control.
thanks alot
Sam
Option Explicit
Public Type LinkInfo
LinkText As New Collection
LinkHref As New Collection
End Type
Public Function GetLinkInfo(WB As WebBrowser) As LinkInfo
'This will return all of the links in the page with
'the url of the link and the text (if any).
'then run through the UDT Collections testing the
'innertext/LinkText against the string you are wanting to find.
Dim L
For Each L In WB.Document.Links
GetLinkInfo.LinkHref.Add L.Href
GetLinkInfo.LinkText.Add L.innertext
Next
End Function
Private Sub cmdExtract_Click()
Dim MyInfo As LinkInfo
Dim c As Long
c = 1
MyInfo = GetLinkInfo(WB1)
Do Until c = MyInfo.LinkText.Count + 1
MsgBox MyInfo.LinkText.Item(c) & " " & MyInfo.LinkHref.Item(c)
c = c + 1
Loop
End Sub
I have this code which was given by a programmer. it extracts the LinkText and LinkHref from a WebBrowser.
Could any one help. I need a code to use on Inet control.
thanks alot
Sam
Option Explicit
Public Type LinkInfo
LinkText As New Collection
LinkHref As New Collection
End Type
Public Function GetLinkInfo(WB As WebBrowser) As LinkInfo
'This will return all of the links in the page with
'the url of the link and the text (if any).
'then run through the UDT Collections testing the
'innertext/LinkText against the string you are wanting to find.
Dim L
For Each L In WB.Document.Links
GetLinkInfo.LinkHref.Add L.Href
GetLinkInfo.LinkText.Add L.innertext
Next
End Function
Private Sub cmdExtract_Click()
Dim MyInfo As LinkInfo
Dim c As Long
c = 1
MyInfo = GetLinkInfo(WB1)
Do Until c = MyInfo.LinkText.Count + 1
MsgBox MyInfo.LinkText.Item(c) & " " & MyInfo.LinkHref.Item(c)
c = c + 1
Loop
End Sub