View Single Post
 
Old 03-20-2019, 05:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,379
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Simply change all of your:
Code:
  With wdDoc
  ...
  End With
block with:
Code:
  With wdDoc
    ' copy the styles
    .CopyStylesFromTemplate ("C:\Users\Terence Yip\AppData\Roaming\Microsoft\Templates\normal.dotm")
    ' replace headings
    With .Range.Find
      .Find.ClearFormatting
      .Replacement.ClearFormatting
      .Text = ""
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindContinue
      .Format = True
      .Style = "Heading 7"
      .Replacement.Style = "Heading 4"
      .Execute Replace:=wdReplaceAll
      .Style = "Heading 8"
      .Replacement.Style = "Heading 5"
      .Execute Replace:=wdReplaceAll
      .Style = "Heading 9"
      .Replacement.Style = "Heading 6"
      .Execute Replace:=wdReplaceAll
    End With
    'Save and close the document
    .Close True
  End With
You can also delete all the strOutFold code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote