The start tag of
<html version="-//w3c//dtd html 4.01 frameset//en">
has 1 attribute called "version".
The version attribute has a Value of "-//w3c//dtd html 4.01 frameset//en".
An element can contain many attribute/value pairs in the start tag.
This program will get all of the attribute/value pairs of any element.
Sub GetAttributes()
Dim strAttributes As String
Dim objElement As IHTMLElement
'choose any element in the document.
Set objElement = _
ActiveDocument.all.tags("html").Item(0)
strAttributes = _
Mid(objElement.outerHTML, _
Len(objElement.tagName) + 2, _
InStr(1, objElement.outerHTML, ">") - _
Len(objElement.tagName) - 2)
End Sub
Sample Output:
version="-//w3c//dtd html 4.01 frameset//en", xxx=""yyy"
Notice that the attribute/value xxx="yyy" is not legal. I just wanted to demonstrate that this method will extract a string of attribute/value pairs whether they are legal or not.