Altova StyleVision 2024 Enterprise Edition

Property: LastXMLDataOffset as Long



Set or get the cursor position inside LastXMLData element for the end of the range.


Offset positions are based on the characters returned by the Text property and start with 0. When setting a new offset, use -1 to set the offset to the last possible position in the element. The following cases require specific attention:


The textual form of entries in Combo Boxes, Check Boxes and similar controls can be different from what you see on the screen. Although, the data offset is based on this text, there only two valid offset positions, one at the beginning and one at the end of the entry. An attempt to set the offset to somewhere in the middle of the entry, will result in the offset being set to the end.

The textual form of XML Entities might differ in length from their representation on the screen. The offset is based on this textual form.


If LastXMLData / LastXMLDataOffset selects a position before FirstXMLData / FirstXMLDataOffset, the latter gets moved to the new end position.




The authentic range object, or its related view object is not valid.


Invalid offset was specified.

Invalid address for the return parameter was specified.



' ---------------------------------------------

' Scripting environment - VBScript

' Select the complete text of an XMLData element

' using XMLData based selection and ExpandTo

' ---------------------------------------------

Dim objAuthenticView

' we assume that the active document is open in authentic view mode

Set objAuthenticView = Application.ActiveDocument.AuthenticView


' first we use the XMLData based range properties

' to select all text of the first XMLData element

' in the current selection

Dim objRange

Set objRange = objAuthenticView.Selection

objRange.FirstXMLDataOffset = 0  ' start at beginning of element text

objRange.LastXMLData = objRange.FirstXMLData  ' select only one element

objRange.LastXMLDataOffset = -1  ' select till its end


' the same can be achieved with the ExpandTo method

Dim objRange2

Set objRange2 = objAuthenticView.Selection.ExpandTo(spyAuthenticTag)


' were we successful?

If objRange.IsEqual(objRange2) Then



 MsgBox "Ooops"

End If

© 2018-2024 Altova GmbH