ParentNode and ChildNode Correct Syntax Question For VBA (HTML DOM)

MattDW

Board Regular
Joined
Mar 7, 2007
Messages
66
Is there anyone who is familar with HTML DOM data scraping and DOM navigation using VBA, that could give me a hand with parentnode and childnode syntax?

I have a website that contains the columns: No, Date, Updated, Request Type, Request Detail, Latest Notes, Client, Status, Priority, Alert Level, Tech, Location and URL I am looking to data scrape.

The Status column can contain a variety of different values as can the Tech.

My goal is to identify every ticket containing "Equipment to Site" in the "Status" column and then to grab the ticket number for that row, which occurs two objects (tags) up in the hierarchy. I'd like to then write those ticket numbers to an array variable so that I can loop through and recall those ticket numbers later in my code.

Concurrently I'd also like to check the tech name for each Equipment to Site row and if the tech assigned the ticket isn't me to write the ticket number to a different array variable, so I that I can then automate going to each of those ticket pages to reassign the ticket to myself.

The Tech data is below the Equipment to Site in a the third TD tag structure from the Equipment to Site TD object and then down another seven objects down from there.

The parentnode and childnode are new to me and while I've found different examples on the web that demonstrate its use, I don't yet have the syntax correct, which is leaving me with an empty variable (I used a single dimension variable for testing purposes).

As my opening gambit I am using this code to loop through and find each of the "Equipment to Site" objects on the HTML page. Part of the problem may be that I am not properly using the Tagx to then try and call a parentnode or childnode.

Code:
 'Look At Only Element Types Of DIV
    Set Tags = IE.Document.getElementsByTagName("div")

    'If The DIV Button Is Title Named Equipment to Site, Then...
    For Each Tagx In Tags
        If Tagx.getAttribute("title") = "Equipment to Site" Then
            Variable = Tagx.ParentNode.getAttribute("update-container-id")
        End If
    Next

If there is anyone who might be able to help me with the proper syntax for parent and child node, I'd really be very grateful to you.

I've included screenshots of the HTML code (I figured it was easier to see the structure this way with the indentations that way) and what the page with the columns look like.

http://staffweb.psdschools.org/mway/excelquestion/screen capture 1.png - Screenshot of Web Page
http://staffweb.psdschools.org/mway/excelquestion/screen capture 2.png - HTML Code

Thank you so very much!

-Matt- :)
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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