View Single Post
 
Old 07-04-2021, 03:46 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Good to hear you could tweak it to deal with your additional instances not shown in the samples you provided.

Although it doesn't affect the running of the macro, it is worthwhile cleaning up the comments in the code. The comments on this chunk for instance is not correct at all.
Code:
    .ClearFormatting
    .Text = "[:;, ^t]{1,5}zzEndBoldzz" 'inserts unique tag for punctuation before 'means'
    .Replacement.Text = "zzEndBoldzz"
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll

    .Text = "zzEndBoldzz[:;, ^t]{1,5}" 'inserts unique tag for punctuation after 'means'
    .Execute Replace:=wdReplaceAll
    
    .Text = "zzEndBoldzzmeans[:;, ^t]{1,5}" 'Additional word 'means' in para not removed
    .Execute Replace:=wdReplaceAll
1. is removing up to 5 instances of spaces or punctuation characters in front of zzEndBoldzz
2. is removing up to 5 instances of spaces or punctuation characters following zzEndBoldzz
3. is removing 'means and trailing punctuation' if it appears immediately after zzEndBoldzz
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote