-
Here is an alternative.
[vba]Sub ChangeBold()
Selection.HomeKey unit:=wdStory
With Selection.Find
Do While (.Execute(findtext:="<<bold>>", Forward:=True) _
= True) = True
With Selection
.MoveEndUntil cset:="/"
.MoveEnd unit:=wdCharacter, Count:=7
.Text = Left((Right(Selection.Text, _
Len(Selection.Text) - 8)), _
Len(Selection.Text) - 17)
.Font.Bold = True
.Collapse Direction:=wdCollapseEnd
End With
Loop
End With
End Sub[/vba]
This changes:
<<bold>>WORDHere<</bold>>
<<bold>>WORDthere<</bold>>
<<bold>>WORDsomethijg<</bold>>
<<bold>>WORDone<</bold>> <<bold>>WORDtwo<</bold>>
into:
WORDHere
WORDthere
WORDsomethijg
WORDone
WORDtwo
I hard coded the <<BOLD>> and <</BOLD>> lengths, on the assumption the tags are generated. Therefore they will always be the same length. It is never going to be < < BOLD > >. It will always be <<BOLD>> - that is, the same length all the time.
This could of course be changed, similar to your code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules