![]() |
#3
|
||||
|
||||
![]()
If the styles exist in the document and the document is laid out as shown, try the following
Code:
Sub TextChanger() Dim i As Long Const StrFind As String = "ALB,TRI,QIU,FSF" On Error Resume Next Application.ScreenUpdating = False For i = 0 To UBound(Split(StrFind, ",")) With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Format = True .Wrap = wdFindContinue .MatchWildcards = True .Text = "\@" & Split(StrFind, ",")(i) & " = (*^13)" .Replacement.Style = Split(StrFind, ",")(i) .Replacement.Text = "\1" .Execute Replace:=wdReplaceAll End With Next i Application.ScreenUpdating = True End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Format cell and add a comment based on another tab | Catluvr | Excel Programming | 8 | 08-03-2018 09:54 AM |
![]() |
dmcgettigan | Word VBA | 1 | 02-27-2017 08:50 PM |
![]() |
Rtowey | Excel | 1 | 07-21-2015 06:05 AM |