View Single Post
 
Old 11-15-2017, 10:08 PM
gunner359 gunner359 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 6
gunner359 is on a distinguished road
Default How to reproduce MoveUntil problem

This looks like a definite bug in the VBA command MoveUntil.
Could anyone corroborate for me please?

How to reproduce the problem.

Create a new Word document and type about 10 words of text.
Open VBE and type in the following module code:

Sub Macro1()

Dim i As Long

i = Selection.MoveUntil(Cset:="+", Count:=wdForeward)
MsgBox i & " character positions were moved"

End Sub

Put your insertion point at the end of the text. Run Macro1.
Message box displays "0 character positions moved"

Hover the cursor over one of the words and right click New Comment.
Set focus in the document and leave cursor at the end of the text.
Run Macro1. Word hangs with spinning cursor.

Change Count to wdForward and perform steps in the opposite direction
and the MoveUntil works fine.
Reply With Quote