ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   retrieving list items from ordered list in HTML (https://www.excelbanter.com/excel-programming/433155-retrieving-list-items-ordered-list-html.html)

[email protected]

retrieving list items from ordered list in HTML
 
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

joel

retrieving list items from ordered list in HTML
 
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

" wrote:

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


Tim Williams[_2_]

retrieving list items from ordered list in HTML
 
It would help if you could post the HTML (a small example) for the OL
element.

Tim


wrote in message
...
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





All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com