Search code examples
vbams-wordcursor-position

Set Cursor position to right after selection in word VBA


I have code that creates fields on a word document based on selection, but when it is done it has the field selected. I want to select the position right after the field. So if there is a FIELD_ with _ being the position right after the field, it is what I want to select.

I found this:

Dim newSelect As Long: newSelect = Selection.End + 1

to get the Character position but then how do I select based on character position? Or is there another method to acheive this?


Solution

  • Pls try.

    Selection.Collapse Word.wdCollapseEnd
    

    Microsoft documentation:

    Selection.Collapse method (Word)

    enter image description here