View Single Post
 
Old 07-12-2022, 01:50 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,520
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

Quote:
Originally Posted by Shelley Lou View Post
I still can't seem to get the second macro 'ApplyHeadingStyles_Auto' to work - it has a compile error Sub or Function not defined and highlights the word 'Undo' in the line If bLvl = False Then Undo
That should have been ActiveDocument.Undo. Code updated
Quote:
Originally Posted by Shelley Lou View Post
The line .Font.Bold = Choose(i, 1, 1, 0, 0, 0, 0) was still making the heading number bold so I changed this to .Font.Bold = Choose(i, 0, 0, 0, 0, 0, 0) and that seems to have worked.
I did it that way to match the example you posted. Since you want all of them to not be bold, all you need is:
.Font.Bold = False
Quote:
Originally Posted by Shelley Lou View Post
I also needed the paragraphs to have Hanging Indents. I recorded the steps first to get the values .ParagraphFormat.FirstLineIndent = InchesToPoints(-0.5) so after trying many variations I've come up with this code which seems to work.
All you needed to do was change:
.ParagraphFormat.FirstLineIndent = 0 'InchesToPoints(-0.5)
(which was in the code you posted), to:
.ParagraphFormat.FirstLineIndent = InchesToPoints(-0.5)
And change:
Code:
    Select Case i
      Case 1, 2
         .ParagraphFormat.LeftIndent = 0
      Case Else
      .ParagraphFormat.LeftIndent = InchesToPoints((i - 2) * 0.5)
    End Select
to:
Code:
    Select Case i
      Case 1, 2
         .ParagraphFormat.LeftIndent = InchesToPoints(0.5)
      Case Else
      .ParagraphFormat.LeftIndent = InchesToPoints((i - 1) * 0.5)
    End Select
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote