I am trying to create a custom heading but the following code is not correct (fails on the first line) (Styles). I ran a macro and this is the output.
Sub CreateHeading2(msWord As Variant)
With msWord.Styles("Heading 2").Font
.Name = "Arial"
.Size = 10
.Bold = True
.UnderlineColor = wdColorAutomatic
.Color = wdColorBlack
End With
With msWord.Styles("Heading 2").ParagraphFormat
.SpaceBefore = 12
.SpaceBeforeAuto = False
.SpaceAfter = 3
.SpaceAfterAuto = False
.Alignment = wdAlignParagraphCenter
End With
With msWord.Styles("Heading 2").ParagraphFormat
With .Shading
.Texture = wdTexture10Percent
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
With .Borders
.DistanceFromTop = 1
.DistanceFromLeft = 4
.DistanceFromBottom = 1
.DistanceFromRight = 4
.Shadow = False
End With
End With
With ActiveDocument.Styles("Heading 2")
.AutomaticallyUpdate = False
.BaseStyle = "Normal"
.NextParagraphStyle = "Normal"
End With
End Sub