A
andreas
Dear Experts:
I came up with the following macro to insert a nonbreaking space
between the §-symbol followed by any number of blank spaces (usually
one or two) and any following number. For example:
§nonbreakingspace138 (§ 138).
It is running fine. See the code below.
Sub InsertNonBreakingSpace()
Dim rngStory As Range
For Each rngStory In ActiveDocument.StoryRanges
With rngStory.Find
.Text = "(§) {1;}([0-9])"
.MatchWildcards = True
.Execute Replace:=wdReplaceAll, ReplaceWith:="\1^s\2"
End With
Next rngStory
End Sub
But now I would like to expand the macro to insert a nonbreaking
space not only after the §-symbol but also after the number (can be a
number with one, two, three, four etc. digits) that immediatley
follows the first nonbreaking space as in:
§-NonbreakingSpace-138-NonbreakingSpace-Corporate Code (§ 138
Corporate Code)
I did not manage to re-write my code to include the second nonbreaking
space.
Help is appreciated. Thank you very much in advance.
I came up with the following macro to insert a nonbreaking space
between the §-symbol followed by any number of blank spaces (usually
one or two) and any following number. For example:
§nonbreakingspace138 (§ 138).
It is running fine. See the code below.
Sub InsertNonBreakingSpace()
Dim rngStory As Range
For Each rngStory In ActiveDocument.StoryRanges
With rngStory.Find
.Text = "(§) {1;}([0-9])"
.MatchWildcards = True
.Execute Replace:=wdReplaceAll, ReplaceWith:="\1^s\2"
End With
Next rngStory
End Sub
But now I would like to expand the macro to insert a nonbreaking
space not only after the §-symbol but also after the number (can be a
number with one, two, three, four etc. digits) that immediatley
follows the first nonbreaking space as in:
§-NonbreakingSpace-138-NonbreakingSpace-Corporate Code (§ 138
Corporate Code)
I did not manage to re-write my code to include the second nonbreaking
space.
Help is appreciated. Thank you very much in advance.