S
Summer
Need a little help please to extend my find - not sure what is best way - the original pattern does not find "hard space" but word "Section" may have 1 soft or 1 hard space after word "Section". The word "Section" will always have a capital letter.
to include "Section^s10" without followed by "number.number" or
1 soft space after word "Section "
[As a side note the word section should look like: "Section^s" not "Section ". So it is possible to just find/replace that on its own or to include both options in the find which means I am moving to an array?
This is the group I need to find (with either a soft space or ^s space after word "Section" it then "bolds" the selection:
"Section 2.3(b)(i)"
"Section 5"
"Section 12.12(a)
"Section 10.1"
include "Section^s10" without followed by "number.number" or
1 soft space after word "Section "
This is what works now for above search:
'after each successful find of the text, start expanding what was
'found and see if it contains parenthetical characters.
'Section [0-9]{1,}.[0-9]{1,}
Sub SectionBoldWords()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Section^s[0-9]{1,}.[0-9]{1,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
While Right(Selection.Text, 1) = "("
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
While Right(Selection.Text, 1) <> ")"
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
Wend
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
Wend
Selection.MoveRight Unit:=wdCharacter, _
Count:=-1, Extend:=wdExtend
Selection.Font.Bold = True
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
End Sub
to include "Section^s10" without followed by "number.number" or
1 soft space after word "Section "
[As a side note the word section should look like: "Section^s" not "Section ". So it is possible to just find/replace that on its own or to include both options in the find which means I am moving to an array?
This is the group I need to find (with either a soft space or ^s space after word "Section" it then "bolds" the selection:
"Section 2.3(b)(i)"
"Section 5"
"Section 12.12(a)
"Section 10.1"
include "Section^s10" without followed by "number.number" or
1 soft space after word "Section "
This is what works now for above search:
'after each successful find of the text, start expanding what was
'found and see if it contains parenthetical characters.
'Section [0-9]{1,}.[0-9]{1,}
Sub SectionBoldWords()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Section^s[0-9]{1,}.[0-9]{1,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
While Right(Selection.Text, 1) = "("
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
While Right(Selection.Text, 1) <> ")"
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
Wend
Selection.MoveRight Unit:=wdCharacter, _
Count:=1, Extend:=wdExtend
Wend
Selection.MoveRight Unit:=wdCharacter, _
Count:=-1, Extend:=wdExtend
Selection.Font.Bold = True
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Wend
End Sub