LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default VBA to read HTML; Search for TDelement

I have code which goes to a internal corporate site, takes names from
ColumnZ in my spreadsheet, and pops them into a search box on a
company web site, searches, and returns, the results in another web
page. All of this works fine. Now, I’m trying to look through the TD
Elements on the search page, find something called SOEID, and import
the inner text (from that) into my spreadsheet, into ColumnAA. For
now, I’m testing to see if I can get the results into a MsgBox. If I
get that I can get the rest working. I noticed that TDelement.bgColor
= "#d9d9d9" will give me the SOEID, but there are a few
TDelement.bgColor = "#d9d9d9" in the page, so I have to drill down
another level…



Directly under TDelement.bgColor = "#d9d9d9 is <span
class="fineleft". This too is not unique, but under this is SOEID
and this is unique! So I want to search for that combination, and
import the inner text of the SOEID.



This is how it looks in the IE Developer Tool:

<td width="15%" bgColor="#d9d9d9"

<span class="fineleft"

Text – SOEID

<td width="15%"

<span class="fineattr"

Text - GT89111



I want to import that ‘GT89111’



Set TDelements = HTMLdoc.getElementsByTagName("TD")

For Each TDelement In TDelements

If TDelement.bgColor = "#d9d9d9" And . . . < -- problem is here . . .
Then

MsgBox (TDelement.innerText)

‘sa = TDelement.innerText

‘ With Sheets("List of FAs")

‘ .Range("AA" & CStr(RowCount)).Value =
sa

‘ End With

End If

Next

RowCount = RowCount + 1



How can I reference this:

<span class="fineleft"





Or, how can I reference this:

objCell.innerText

itm.innerText



So, any ideas on how to do this? I’m sure it is possible. I’m just
at a loss now as to how to actually do it.



Thanks everyone!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search HTML [email protected] Excel Programming 1 October 30th 08 02:09 AM
Search HTML Source code. [email protected] Excel Programming 0 October 29th 08 01:15 PM
Search and replace chunks of html code method373 Excel Discussion (Misc queries) 0 March 27th 06 03:46 PM
How to read HTML [email protected] Excel Programming 2 January 2nd 06 05:33 PM
REQ: Simplest way to parse (read) HTML formatted data in via Excel VBA (or VB6) Steve[_29_] Excel Programming 3 August 25th 03 10:43 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"