Get rid of redundant BB Code tag pairs in MS Word text
Test
[COLOR=black][b]This will usually be black anyway[/b], not [color=orange]orange[/color], ([/COLOR] [color=purple]Purple[/color] [COLOR=black] is my favourite ) so I really don’t need the black color BB Code tag pairs [/COLOR]
This will usually be black anyway, not orange, ( Purple is my favourite ) so I really don’t need the black color BB Code tag pairs
[b]This will usually be black anyway[/b], not [color=orange]orange[/color], ( [color=purple]Purple[/color] is my favourite ) so I really don’t need the black color BB Code tag pairs
This will usually be black anyway, not orange, ( Purple is my favourite ) so I really don’t need the black color BB Code tag pairs
Trying to do that with wild stuff, makes my brain hurt a lot...... :(
Answer from Stuart at Eileen'sLounge: https://eileenslounge.com/viewtopic....299529#p299529
https://i.postimg.cc/mDvfF9HP/Stuarts-In-German.jpg
https://i.postimg.cc/mDvfF9HP/Stuarts-In-German.jpg
Code:
Sub RemoveBlackBBCodeTagPairs() ' https://eileenslounge.com/viewtopic.php?p=299529#p299529
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\[COLOR=black\](*)\[/COLOR\]"
.Replacement.Text = "\1"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Hans simplified
Code:
' https://eileenslounge.com/viewtopic....299537#p299537
Sub RemoveBlackBBCodeTagPairs() '
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\[COLOR=black\](*)\[/COLOR\]"
.Replacement.Text = "\1"
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End Sub
Get rid of redundant BB Code tag pairs in MS Word text
Get rid of redundant BB Code tag pairs in MS Word text
Get rid of redundant BB Code tag pairs in MS Word text