【问题标题】:Moving the cursor after the inserted word在插入的单词后移动光标
【发布时间】:2019-07-24 17:37:44
【问题描述】:

在我的 VBA 宏中,我将一些文本插入到活动文档中。 插入后,光标不在插入的单词后面,如果您手动键入它,而是在插入的单词之前。如何移动它?

Dim insertedText As String
insertedText = "test"

With ActiveDocument
    .Range.InsertAfter insertedText
    'move the cursor behind insertedText
End With

【问题讨论】:

    标签: vba ms-word


    【解决方案1】:

    Nvm,我通过在 with 语句后添加这段代码解决了它

    Selection.Move wdCharacter, Len(insertedText)
    

    还是谢谢!

    【讨论】:

      猜你喜欢
      • 2022-10-11
      • 1970-01-01
      • 1970-01-01
      • 2019-10-13
      • 1970-01-01
      • 2020-07-10
      • 2013-10-23
      • 2018-09-21
      • 1970-01-01
      相关资源
      最近更新 更多