Identifying tag for GetElementsByTagName

Gino_Vernisci

New Member
Joined
Jul 13, 2011
Messages
20
Hi All

I have written a bit of VBA code that opens an IE web browser, navigates to an online database and inputs the search information. Now I would like to take the results (which are in a table) and put them into the spreadsheet.

My research so far indicates that the best way to do this is is with the "GetElementsByTagName" tool in VBA. My two problems are

1) How do I use "GetElementsByTagName"
2) How do I identify the appropriate tag in the HTML source code

The source code is below. I am certain that this is the bit of code that houses the table of interest to me but I don't know how to find/use the tag.

Code:
<span class="TableTitle" id="accttabletitle">Search Results from Existing Accounts</span>
            <span id="QueryStatus4"> </span>
            <table id="Results" border="0" cellpadding="0" cellspacing="0" width="100%">
                <thead>
                    <tr id="tblData" align="left">
                        <td class="GridHeader" style="width: 25%" align="left">
                              Account Name</td>
                        <td class="GridHeader" style="width: 10%" align="left">
                              State</td>
                        <td class="GridHeader" style="width: 10%" align="left">
                              ZipCode</td>
                        <td class="GridHeader" style="width: 20%" align="left">
                              Region</td>
                        <td class="GridHeader" style="width: 20%" align="left">
                              Market Leader</td>
                        <td class="GridHeader" style="width: 15%" align="left">
                              Region Phone</td>
                    </tr>
                </thead>
                <tbody id="mytbodycl" name="mytbodycl">
                </tbody>
            </table>

Any help would be greatly appreciated

Gino
Excel 2007 Windows XP
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Ha Sorry I should have previewed the post and known it would turn the source code into the actual table. Obviously my third question is, "How do I post source code in this forum?"
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,513
Members
449,168
Latest member
CheerfulWalker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top