![]() |
|
|
|
#1
|
||||
|
||||
|
You might also be interested in:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[A-Z]{3} [0-9]{2}-[0-9]{3},[!^13]@[0-9]{4}^13"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
With .Duplicate
.End = .Start + InStr(.Text, ",") - 1
.Style = "Strong"
End With
With .Duplicate
.End = .Start + InStrRev(.Text, ",") - 1
.Start = .Start + InStrRev(.Text, ",")
.Style = "Emphasis"
End With
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does a new set of styles in a template overwrite or remove the existing set of styles in a document? | dianahbr | Word | 6 | 03-27-2018 11:12 PM |
| Two much blank space between names of styles in the Styles Pane | PereCasanellas | Word | 0 | 10-06-2017 03:47 AM |
| Question about spacing between multi-level bullet styles (and other styles) | SDwriter | Word | 0 | 09-26-2017 09:39 AM |
Delete does not bring second sentence closer to first sentence
|
Andoheb | Word | 29 | 07-03-2014 01:48 PM |
Quick Styles Set saved but it doesnt appear at the styles list!
|
Pedro77 | Word | 3 | 10-15-2011 05:17 AM |