我有一个宏,用于扫描我的文档中的“标题1”样式,因此光标会移动到最后一个匹配项之后。
我正在尝试在此扫描发生之前捕获光标位置,然后在扫描完成后返回该位置。我该如何做?
我在SO上找到了这个答案,但它不起作用(没有错误,只是不做任何事情)。
我正在尝试在此扫描发生之前捕获光标位置,然后在扫描完成后返回该位置。我该如何做?
我在SO上找到了这个答案,但它不起作用(没有错误,只是不做任何事情)。
Application.ScreenUpdating = False ' Turn screen updates off so the user will not know that the cursor has moved
Dim currentPosition As Long
currentPosition = Selection.Range.Start
{... do stuff here ...}
Selection.Range.Start = currentPosition
Application.ScreenUpdating = True