![]() |
|
|
|
#1
|
|||
|
|||
|
Code:
Sub Demo()
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.ClearFormatting
.Text = "(^0147)([A-Z]*)([^0148])"
.MatchWildcards = True
While .Execute
oRng.Start = oRng.Start + 1
oRng.End = oRng.End - 1
oRng.Style = ActiveDocument.Styles("Strong") 'replace with your style
oRng.Collapse wdCollapseEnd
Wend
End With
lbl_Exit:
Exit Sub
End Sub
|
|
#2
|
|||
|
|||
|
Thanks. It works with the strong style but when I add my style into the macro it applies to the entire paragraph. Could there be some setting in my Style causing it to do that?
EDIT: Nevermind! I figured out the issue with my Style. Thanks again Last edited by WVA; 07-29-2019 at 06:35 AM. Reason: Fixed |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My style keeps changing, can't get saved style to apply | Meenie50 | Word | 7 | 07-20-2017 03:47 PM |
Apply Heading Style When Combining Documents
|
snot369 | Word | 1 | 01-13-2017 11:04 AM |
| Is it possible to have a style apply two formats based upon text? | DMcCollum | Word | 3 | 05-02-2015 06:29 PM |
Can I apply a style to an image?
|
humbleosity | Word | 1 | 01-14-2014 09:38 AM |
Macro to apply style to selected tables
|
ubns | Word | 1 | 08-02-2012 04:09 AM |