View Single Post
 
Old 05-26-2018, 12:34 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The following should work.
Code:
Sub MarkParenthesizedItalicsNoProofing()
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Text = "\([A-Z][a-z.][!\(]@\)"
    .Replacement.Text = ""
    .Forward = True
    .Format = False
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found
    .Start = .Start + 1
    .End = .End - 1
    If .Font.Italic = True Then .NoProofing = True
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
End Sub
Note that there is a flaw in your own Find expression:
[!\)]
should be:
[!\(]
Otherwise it will fail if there are unmatched parentheses and the entire unmatched string is not italic.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote