|
-
Sep 23rd, 2005, 03:16 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Get Link Name
Hi, I am using a webbrowser and the MS HTML Object library to add the links of a site to a listbox on my form. The problem is that I need to know what the text of the hyperlink is. I already know how to get the URL of the link with the HTML Object library but is there an easy way to get the text that it is linked with.
eg:
HTML Code:
<a href="http://www.google.com">Google Is Here</a>
I want to get the text "Google Is Here".
-
Sep 23rd, 2005, 06:55 AM
#2
Re: Get Link Name
Where would "Google is here" be coming from?
Is this just static text that you want included with each link? Like if your link was www.vbforms.com the text would be "VBForums is here"?
-
Sep 23rd, 2005, 01:43 PM
#3
Thread Starter
Fanatic Member
Re: Get Link Name
No m8, I would need to parse it from the html so that I can have on my form a button that says "Google Is Here" or whatever the text on the link is and then when the user clicks it http://www.google.com will be opened or whatever the URL of the link is.
-
Sep 23rd, 2005, 01:57 PM
#4
Lively Member
Re: Get Link Name
You can simply call the innerText or innerHTML for the link object.
For example (I am going on memory here, forgive any syntax errors)
VB Code:
Dim I As Integer
' I don't remember if the document.links array is zero or one based.
For I = 0 To document.links.length -1
Debug.Print document.links(I).innerText
Debug.Pring document.links(I).innerHTML
Next
-
Sep 23rd, 2005, 02:09 PM
#5
Thread Starter
Fanatic Member
Re: Get Link Name
wow, that worked brilliantly!
Thanx a lot BradBrening, thread resolved!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|