![]() |
#7
|
||||
|
||||
![]()
I'm not a fan of the selection object and I would think you need to be explicit in settintg the direction of the search. There also seems to be a flaw with the No Proofing not catching the first word if it is immediately preceded by a bracket. Try this variation
Code:
Sub MarkParenthesizedItalicsNoProofing() Dim aRng As Range, aSubRng As Range Set aRng = ActiveDocument.Range With aRng.Find .ClearFormatting .Text = "\([A-Z][a-z.]@[!\)]@\)" .MatchWildcards = True .Forward = True .Wrap = False Do While .Execute Set aSubRng = ActiveDocument.Range(aRng.Start + 1, aRng.End - 1) aRng.NoProofing = aSubRng.Italic = True aRng.Collapse wdCollapseEnd Loop End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
vba find and replace |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
find IP in range / find number between numbers | gn28 | Excel | 4 | 06-14-2015 03:46 PM |
![]() |
norgro | Word VBA | 1 | 01-23-2015 10:58 PM |
![]() |
Hoxton118 | Word VBA | 7 | 06-10-2014 05:05 AM |
![]() |
jperez84 | Word VBA | 10 | 09-19-2012 04:48 PM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |