In a macro file for a Writer, I browse the text with two text cursor. I wish to compare the position of the two cursors to determine if they are in the same place. I do the following test:
Dim vCurCursor as Variant
Dim vWordsCursor As Variant
Dim vText As Variant
vText = ThisComponent.Text
vCurCursor = vText.CreateTextCursor()
vCurCursor.GoToStart(False)
vWordsCursor = vText.CreateTextCursor()
vWordsCursor.GoToStart(False)
... (some code)
Do
lCountWord = lCountWord + 1
vCurCursor.gotoNextWord(False)
Loop While NOT (vCurCursor = vWordsCursor)
But it does not work with “(vCurCursor = vWordsCursor)”. The test gives the following error.
Runtime Error BASIC.
Invalid property value.