• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Searching HTML Source Codes with unnamed tables?

Luiz Simoes

New Member
Hi Everyone!

I'm sorry if this was somehow answered before, however I've been searching and really didn't find anything that worked for this particular issue.

What I am trying to create is basically a macro in VBA that will open a website (unfortunately it is company confidential and cannot be provided) and search inside for certain information. Here's a step by step of it:

1. Open IE -> Go to website.
2. Once Website is open, compare a given Value to match one that is shown on the website.
3. Once matched, it needs to pull information that is NEXT to it.

Sounds simple, but here are the issues:

1. The tables are all unnamed. Meaning that I cannot use getElementsById, ByTagName (as there can be between 1 or 100 lines and all of them will be TR seperated)
2. There are no constants, other then the first line, but since the information below it is seperated by a completely different table, I cannot do anything with this.
3. The lines are also not constant, meaning a certain match can be at line 80 of HTML, while the next could be line 120, the next at 176, so on and so forth.

I have tried many different attempts, but I just don't think I have the expertise for this. The only "constant" I've noticed is that by each line, it still separates by TR, so maybe I could search by TR to match the given value and then try to pull the information from there. If anyone knows of something I could possibly try, I'd be deeply grateful!

Example of Website Source Code:
<TABLE BORDER="0" CELLPADING ="5" CELLSPACING="2" BGCOLOR="#DFDFDF"
RULES="ROWS" FRAME="VOID" style="border-collapse: collapse"
bordercolor="#111111" cellpadding="0" cellspacing="1" width="2750">
<TR>

<TH ALIGN=CENTER WIDTH="010" bgcolor="#000080" height="21"
bordercolorlight="#000080" bordercolordark="#000080">
<font size=-1 face="Arial,Helvetica" color="#FFFFFF">POID
</font></TH>

All others go on like this afterwards.
 
Nevermind folks, after thoroughly frying my brain on these forums I was able to adapt different codes to capture what I needed :) If anyone would like a sample of it or has a similar doubt I'll be sure to post it later.
 
Hi, Luiz Simoes!
Maybe you want to share your solution with the community, so as people who read this would have the issue or question and the solution or answer as well. So thanks for the offer, and please post it.
Regards!
 
Back
Top