Home » excel » Getting class attribute value using Excel VBA

Getting class attribute value using Excel VBA

Posted by: admin May 14, 2020 Leave a comment


I have some experience web scraping with Excel VBA and so far I can’t find this solution anywhere online. I am trying to inspect if the following div element has the text “dxm-disabled” in its class value.

<div class="dxm-content dxm-hasText dxm-disabled" style="vertical-align:middle;" id="AcknowledgeSplitter"> .... </div>

I know how to locate the div element using its ID but I am out of idea how to get the class value. I have already tried doing IE.Document.getElementById("AcknowledgeSplitter").getAttribute("class") but I get an empty string.

How to&Answers:

This should work: