![]() |
|
#1
|
||||
|
||||
![]() Quote:
If you want something that will catch all the examples you have now given, you could use: Find =, [A-Z][!,]@ [A-Z][!,]@, This will capture all instances of a comma, followed by a space, then a proper-case word, any number of characters other than a comma, finally a space and another proper-case word (hyphenated or otherwise) before a comma. Again, the macro equivalent to italicize all such text (since I still don't know what you want to do with what you find) would be: Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Italic = True .Text = ", [A-Z][!,]@ [A-Z][!,]@," .Replacement.Text = "^&" .Forward = True .Wrap = wdFindContinue .Format = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
alex100 | Word VBA | 1 | 01-02-2021 02:39 PM |
![]() |
totoMSOF | Word VBA | 19 | 03-11-2019 01:28 PM |
![]() |
abdan | Word VBA | 3 | 01-18-2019 09:38 PM |
Macro help regex | subspace3 | Word VBA | 1 | 10-15-2014 09:53 AM |
Regex in Word: Replaced strings are in disorder | chgeiselmann | Word | 0 | 04-26-2009 11:33 AM |