Anchor Text elements in the VB6 WebBrowser Control - Advanced
Posted on 2007-08-09
I am programming in vb6, but not Dot Net, so I would like to find a solution for vb6.
Here is my code:
set HTMLdoc = frmBrowser.WebBrowser1.Document
pageSource = frmBrowser.WebBrowser1.Document.body.innerHTML
if InStr(pageSource, Text1,) <> 0 Then
' text found
For Each HTMLlinks in HTMLdoc.links
strResult = HTMLlinks.href Like "*/target-text/*"
If strResult = True Then
MsgBox HTMLlinks.href ' HERE IS MY QUESTION
The code works as intended. It is only giving me the links that I need to get from the HTML source.
The problem I am experiencing is that I also want to extract the Anchor Text from the same link.
Is there a way to do this through a HTMLlinks.property?
All I can figure to do right now is to extract the target URL's and then to use Split commands to widdle down the innerHTML to extract the specific anchor text from the connected link. This is problematic if the page references the same URL more than one time, so I would need to build the extraction code within the procedure above to make sure that I am getting the correct Anchor Text from the correct link.
So, is there a way that I can accomplish this using the webbrowser control elements in vb6?
I hope so.