View Single Post
 
Old 12-24-2015, 02:43 AM
jc491's Avatar
jc491 jc491 is offline Windows 10 Office 2016
VBA Novice
 
Join Date: Sep 2015
Location: UK
Posts: 55
jc491 is on a distinguished road
Default

Hello Paul,

thank you so much for helping me again for the zillionth time

I run the code and here is what I get




Code:
Sub PaulDemo()
Application.ScreenUpdating = False

Dim StrSty As String, StrRep As String, i As Long

StrSty = " Strong, Heading 1"

StrRep = "Placeholder1 ^& Placeholder2,Heading 1 ^& Heading2"

With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Format = True
  .Wrap = wdFindContinue
  .MatchWildcards = True
  For i = 0 To UBound(Split(StrSty, ","))
    .Style = Split(StrSty, ",")(i)
    .Replacement.Text = Split(StrRep, ",")(i)
    .Execute Replace:=wdReplaceAll
  Next
End With
Application.ScreenUpdating = True
End Sub
The placeholders should be around each word as they show in the code, sorry for being a pain, have I not run it properly again.


forever grateful

J
Reply With Quote