J
joncohen
I am trying to use the MoveEndUntil to expand the selected range in this
code, however, the text "WORK" is on a different line then the text "MEDICAL
RECORDS:". When I debug this logic the selected range stops one word after
medical records on the second line. Not sure if I can use "MoveEndUntil" to
extend beyond a single sentence. The version of word is 2003, any help
would be appreciated.
Thx,
Jonathan
TxtStrg = "MEDICAL RECORDS:"
Set BMRange = ActiveDocument.Range
Set BMRngRsult = BMRange.Duplicate
Do
With BMRngRsult.Find
.ClearFormatting
.Text = TxtStrg
.Forward = True
.Wrap = wdFindStop
.Execute
End With
If Not BMRngRsult.Find.Found Then Exit Do
BMRngRsult.Select
BMRngRsult.Bold = wdToggle
'Selection
With BMRngRsult
.MoveEndUntil Cset:="WORK ", Count:=wdForward
' .MoveEnd Unit:=wdSentence, Count:=3
.Select
End With
BMRngRsult.MoveStart wdWord
BMRngRsult.End = BMRange.End
Loop Until Not BMRngRsult.Find.Found
code, however, the text "WORK" is on a different line then the text "MEDICAL
RECORDS:". When I debug this logic the selected range stops one word after
medical records on the second line. Not sure if I can use "MoveEndUntil" to
extend beyond a single sentence. The version of word is 2003, any help
would be appreciated.
Thx,
Jonathan
TxtStrg = "MEDICAL RECORDS:"
Set BMRange = ActiveDocument.Range
Set BMRngRsult = BMRange.Duplicate
Do
With BMRngRsult.Find
.ClearFormatting
.Text = TxtStrg
.Forward = True
.Wrap = wdFindStop
.Execute
End With
If Not BMRngRsult.Find.Found Then Exit Do
BMRngRsult.Select
BMRngRsult.Bold = wdToggle
'Selection
With BMRngRsult
.MoveEndUntil Cset:="WORK ", Count:=wdForward
' .MoveEnd Unit:=wdSentence, Count:=3
.Select
End With
BMRngRsult.MoveStart wdWord
BMRngRsult.End = BMRange.End
Loop Until Not BMRngRsult.Find.Found