K
Klaus Linke
VBA becomes unresponsive (endless loop that you can't stop with Ctrl+Pause)
if you do the following (Word2003):
-- Type some text.
-- At the end of the paragraph, add a comment.
-- Select the paragraph.
-- Run the following code:
Dim myRange As Range
Set myRange = Selection.Range.Duplicate
myRange.MoveEndWhile CSet:=vbCr, Count:=wdBackward ' endless loop
myRange.Select ' expected result: text without para mark is selected
If comment markers are shown ("[B1]" ...; Ascii-Code ^5), there isn't a
problem.
But if they are not shown (say in Page Layout View with comments shown in
balloons, or in Normal View with hidden text not displayed), Word gets into
a twist, and you have to kill it with the task manager.
Regards,
Klaus
if you do the following (Word2003):
-- Type some text.
-- At the end of the paragraph, add a comment.
-- Select the paragraph.
-- Run the following code:
Dim myRange As Range
Set myRange = Selection.Range.Duplicate
myRange.MoveEndWhile CSet:=vbCr, Count:=wdBackward ' endless loop
myRange.Select ' expected result: text without para mark is selected
If comment markers are shown ("[B1]" ...; Ascii-Code ^5), there isn't a
problem.
But if they are not shown (say in Page Layout View with comments shown in
balloons, or in Normal View with hidden text not displayed), Word gets into
a twist, and you have to kill it with the task manager.
Regards,
Klaus