A
Alan Stancliff
Greetings,
I am running Word 2003 and transcribing medical dictation
I have a macro put together some time ago with the kind help of some of
the members of this forum. Its purpose is to replace all instances of 2
or more consecutive spaces with 1 space and to replace all instances of
a paragraph marker preceded with a space to just a paragraph marker. A
hot key activates the macro, and it is supposed to run without moving
the insertion point or causing the page or viewpoint to jump.
Sometimes this macro works just like that. But at other times, running
the macro results in it finishing with the entire document highlighted,
and only an arrow key will unselect the material, causing the insertion
point to locate either at the very top or very bottom of the document,
depending on which arrow key I press.
Can anyone give me an idea what to do? The macro is attached below.
Regards,
Alan Stancliff
**************
Sub SingleSpace()
Dim oRg As Range
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
Application.Run MacroName:="FixFindBox"
End Sub
I am running Word 2003 and transcribing medical dictation
I have a macro put together some time ago with the kind help of some of
the members of this forum. Its purpose is to replace all instances of 2
or more consecutive spaces with 1 space and to replace all instances of
a paragraph marker preceded with a space to just a paragraph marker. A
hot key activates the macro, and it is supposed to run without moving
the insertion point or causing the page or viewpoint to jump.
Sometimes this macro works just like that. But at other times, running
the macro results in it finishing with the entire document highlighted,
and only an arrow key will unselect the material, causing the insertion
point to locate either at the very top or very bottom of the document,
depending on which arrow key I press.
Can anyone give me an idea what to do? The macro is attached below.
Regards,
Alan Stancliff
**************
Sub SingleSpace()
Dim oRg As Range
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With
Application.Run MacroName:="FixFindBox"
End Sub