retrieving list items from ordered list in HTML

D

dtshedd

hello

I am using the getelementsbytagname="OL" method(?) to capture items in
an ordered list. Each list item is an anchor and a label (link to
another web site). I want to capture the label but not the anchor. I
am not sure how to use innertext to capture one part versus the
other. when capturing table data I can do this with .Rows(j).Cells
(0).innertext not sure what to do with a LI

tia
 
J

Joel

There may be a property href that has the daa you are looking for. I often
set break point and watch items to troubleshgoot these type problems

set itm = getelementsbytagname="OL"
a = 1 'set break point on this line and then add a watch to the variable
itm.

You can set the watch by right clicking on "ITM" and then select Add Watch.


another method that sometimes helps is dumping the webpage into the workbook
like this

RowCount = 1
for each itm in IE.document.all
Range("A" & Rowcount) = itm.tagname
Range("B" & Rowcount) = itm.classname
Range("C" & Rowcount) = itm.id
Range("D" & Rowcount) = left(itm.innertext,1024)

RowCount = rowCount + 1
next itm
 
T

Tim Williams

It would help if you could post the HTML (a small example) for the OL
element.

Tim
 
D

dtshedd

It would help if you could post the HTML (a small example) for the OL
element.

Tim








- Show quoted text -

Sorry I did not post a followup sooner.

the line I am using

Set oL=ieApp.document,getelementsbytagname ("OL")

For Each li In oL

MsgBox li.innertext

Next

this gets me the label, when i want the anchor

sorry i mispoke earlier
 
T

Tim Williams

That's not HTML...

Tim

It would help if you could post the HTML (a small example) for the OL
element.

Tim








- Show quoted text -

Sorry I did not post a followup sooner.

the line I am using

Set oL=ieApp.document,getelementsbytagname ("OL")

For Each li In oL

MsgBox li.innertext

Next

this gets me the label, when i want the anchor

sorry i mispoke earlier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top