A
Alan Stancliff
I have been using a macro at work to take all double spacing after
periods, colons, etc, out of a document and replace them with double
spaces. This macro works on the entire document.
The document is broken into three sections, as defined by the menu items
INSERT>BREAK>CONTINUOUS. I have been trying to figure out how it can
be made to work this magic on only section 2.
This macro is mostly based on one I found in a Word website, and the
proper credit is given in the comment section.
Here is the macro. Any assistance would be very much appreciated.
Sub SingleSpace()
'
'<alt><ctrl><5>
' Changes 2 spaces after periods and colons
' to 1 space in conformity with our hospital
' guidelines.
' Macro modified by Alan Stancliff, based on macro
' copied from Allen Wyatt's Word Tips
'
http://wordtips.vitalnews.com/Pages/T1497_An_Automatic_Two_Spaces_After_a_Period.html
' ******************************
'
Selection.Find.ClearFormatting
'Selection.Find.ClearFormatting.Section (2)
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!\:]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run MacroName:="FixFindBox"
End Sub
Regards,
Alan Stancliff
periods, colons, etc, out of a document and replace them with double
spaces. This macro works on the entire document.
The document is broken into three sections, as defined by the menu items
INSERT>BREAK>CONTINUOUS. I have been trying to figure out how it can
be made to work this magic on only section 2.
This macro is mostly based on one I found in a Word website, and the
proper credit is given in the comment section.
Here is the macro. Any assistance would be very much appreciated.
Sub SingleSpace()
'
'<alt><ctrl><5>
' Changes 2 spaces after periods and colons
' to 1 space in conformity with our hospital
' guidelines.
' Macro modified by Alan Stancliff, based on macro
' copied from Allen Wyatt's Word Tips
'
http://wordtips.vitalnews.com/Pages/T1497_An_Automatic_Two_Spaces_After_a_Period.html
' ******************************
'
Selection.Find.ClearFormatting
'Selection.Find.ClearFormatting.Section (2)
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!\:]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run MacroName:="FixFindBox"
End Sub
Regards,
Alan Stancliff