A
Alan Stancliff
Hi All,
I am running Word 2003.
Right now, I have a macro that changes 2 spaces to 1 space in a
document, and I need to refine it a bit. I am posting this macro at the
end of this message.
The problems are two:
First, I need this macro to change spaces only in section 2 of a
3-section document, leaving things as they are in section 1 and section 3.
Second, I want this macro to change 2 or more consecutive spaces to 1
space. So if there are 3 or more spaces somewhere in section 2 of the
document, it changes them to 1 space.
Any Ideas?
Sub TwoSpaceToOne
Dim twospace As Range
Set twospace = ActiveDocument.Range
With twospace.Find
..ClearFormatting
..Replacement.ClearFormatting
..Text = " "
..Replacement.Text = " "
..Forward = True
..Wrap = wdFindContinue
..Format = False
..MatchWildcards = False
..Execute Replace:=wdReplaceAll
End With
end sub
Regards,
Alan
I am running Word 2003.
Right now, I have a macro that changes 2 spaces to 1 space in a
document, and I need to refine it a bit. I am posting this macro at the
end of this message.
The problems are two:
First, I need this macro to change spaces only in section 2 of a
3-section document, leaving things as they are in section 1 and section 3.
Second, I want this macro to change 2 or more consecutive spaces to 1
space. So if there are 3 or more spaces somewhere in section 2 of the
document, it changes them to 1 space.
Any Ideas?
Sub TwoSpaceToOne
Dim twospace As Range
Set twospace = ActiveDocument.Range
With twospace.Find
..ClearFormatting
..Replacement.ClearFormatting
..Text = " "
..Replacement.Text = " "
..Forward = True
..Wrap = wdFindContinue
..Format = False
..MatchWildcards = False
..Execute Replace:=wdReplaceAll
End With
end sub
Regards,
Alan