Link to home
Start Free TrialLog in
Avatar of James
James

asked on

Get more than one getElementsByTagName in loop?

How do you obtain more than one TAG when recursing a document? What I am asking is how whould I extract a TABLE following the "A" link below? In other words, once I find a href link....move next extract the table following it so I can print both the link AND the first TABLE that follows after it!


Dim alink As HTMLLinkElement
Dim table As HTMLLinkElement
 
  For Each alink In WebBrowser1.Document.getElementsByTagName("A")
' just need to figure out how to get the table below the LINK!

debug.print alink
   
  Next
 
Avatar of AzraSound
AzraSound
Flag of United States of America image

Avatar of James
James

ASKER

That sample wasn't any help.

How can I just check for a match in a loop to the elements? Like this:

Dim alink As HTMLLinkElement
Dim bfound as Boolean

  For Each alink In WebBrowser1.ALL

'Check if alink is a "A" tag then grab its text
' set a boolean to true if "A" has been found then
'next loop grab the "TABLE" text and set boolean = false and continue looking
'for the next "A" link

  Next

How difficult is it to make this work?

ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial