VBA Determine Object Type. ( From HTML DOM Object ( Node Type ) ). Put Type in String variable. ( Like that type shown in Watch and Immediate Windows.
Hi
I am using the Watch and Immediate Windows to good effect to monitor some parts of a code.
This is OK, but in addition I would like to be able to store in a String variable some things I am seeing in these Windows. ( Ultimately I want to print out the string to a sort of “Debug Worksheet” or “Résumé Worksheet” )
In particular, currently I have a Variable of Type Object. This changes its type, that is to say is Set to a different variable at different parts of a code. It is not always obvious ( to me ) what this Object type might be at any point. (_...... It is set to different nodes in a Document Object Model made from a .HTML files I made or “Got” from the URL of a website, _........- this Thread is a bit related to this one
http://www.excelforum.com/excel-prog...te-change.html
_......)
)
_.....
So anyway. I see these for example during a code run
objHTMLTableCell.JPG
objHTMLTableCell.JPG
objDispHTMLDOMTextNode.JPG
objDispHTMLDOMTextNode.JPG
I want in a string variable something to give me an indication of the Object Type, of this form or similar
“HTMLTableCell”
Or
“DispHTMLDOMTextNode”
Similarly I see in the same place in the Immediate window at other parts of the code a different Object type and correspondingly I am looking for getting a string of this form
“HTMLTable”
“HTMLTableSection”
“HTMLTableRow”
“DispHTMLDOMTextNode”
I tried
Debug.Print Elem
This always returns [object] for the above example 
[object]
[object]
[object]
[object]
[object]
[object]
I tried looking at Elem.NodeType
This gives me for the above example_....
Element
Text
Element
Element
Element
Element
Text
_...... this is only a bit better.
_.............
So does anyone know how I can get info into a string, that will look like that Object type description I see in the Immediate and Watch Windows. I guess that info must be somewhere – or else VBA could not put it in those windows... )
Thanks
Alan
Bookmarks