AuthenticRange.FirstXMLData
Property: FirstXMLData as XMLData
Description
Set or get the first XMLData element in the underlying document that is partially, or completely selected by the range. The exact beginning of the selection is defined by the FirstXMLDataOffset attribute.
Whenever you set FirstXMLData to a new data object, FirstXMLDataOffset gets set to the first cursor position inside this element. Only XMLData objects that have a cursor position may be used. If you set FirstXMLData / FirstXMLDataOffset selects a position greater then the current LastXMLData / LastXMLDataOffset, the latter gets moved to the new start position.
HINT: You can use the FirstXMLData and LastXMLData properties to directly access and manipulate the underlying XML document in those cases where the methods available with the AuthenticRange object are not sufficient.
Errors
2001 | The authentic range object, or its related view object is not valid. |
2005 | Invalid address for the return parameter was specified. |
2008 | Internal error |
2009 | The XMLData object cannot be accessed. |
Examples
' -----------------------------------------------
' Scripting environment - VBScript
' show name of currently selected XMLData element
' -----------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objXmlData
Set objXMLData = objAuthenticView.Selection.FirstXMLData
' authentic view adds a 'text' child element to elements
' of the document which have content. So we have to go one
' element up.
Set objXMLData = objXMLData.Parent
MsgBox "Current selection selects element " & objXMLData.Name