Writer&';s Friend


by Dale Stubbart

WrF_Set_Styles

Donate here

Sub WrF_Set_Styles()
' Initial Style Settings for Title, Subtitle, Heading 1, Heading 2, Normal, No Spacing
Dim WrF_Style_Names(1 To 6) As String: WrF_Style_Names(1) = wdStyleTitle: WrF_Style_Names(2) = wdStyleSubtitle: WrF_Style_Names(3) = wdStyleHeading1: WrF_Style_Names(4) = wdStyleHeading2: WrF_Style_Names(5) = wdStyleNormal: WrF_Style_Names(6) = "No Spacing"
Dim WrF_Style_BasedOns(1 To 6) As String: WrF_Style_BasedOns(1) = wdStyleNormal: WrF_Style_BasedOns(2) = wdStyleNormal: WrF_Style_BasedOns(3) = wdStyleNormal: WrF_Style_BasedOns(4) = wdStyleNormal: WrF_Style_BasedOns(5) = "": WrF_Style_BasedOns(6) = ""
Dim WrF_Style_B4_Font_Names(1 To 6) As String: WrF_Style_B4_Font_Names(1) = "Calibri Light": WrF_Style_B4_Font_Names(2) = "+Body": WrF_Style_B4_Font_Names(3) = "Calibri Light": WrF_Style_B4_Font_Names(4) = "Calibri Light": WrF_Style_B4_Font_Names(5) = "Calibri": WrF_Style_B4_Font_Names(6) = "Calibri"
Dim WrF_Style_B4_Font_Sizes(1 To 6) As Integer: WrF_Style_B4_Font_Sizes(1) = 28: WrF_Style_B4_Font_Sizes(2) = 11: WrF_Style_B4_Font_Sizes(3) = 16: WrF_Style_B4_Font_Sizes(4) = 13: WrF_Style_B4_Font_Sizes(5) = 11: WrF_Style_B4_Font_Sizes(6) = 11
Dim WrF_Style_B4_Font_Bolds(1 To 6) As Boolean: For i = 1 To 6: WrF_Style_B4_Font_Bolds(i) = False: Next i
Dim WrF_Style_B4_Font_Italics(1 To 6) As Boolean: For i = 1 To 6: WrF_Style_B4_Font_Italics(i) = False: Next i
Dim WrF_Style_B4_Font_Colors(1 To 6) As String: WrF_Style_B4_Font_Colors(1) = wdColorAutomatic: WrF_Style_B4_Font_Colors(2) = "Text 1": WrF_Style_B4_Font_Colors(4) = "Accent 1": WrF_Style_B4_Font_Colors(4) = "Accent 1": WrF_Style_B4_Font_Colors(5) = wdColorAutomatic: WrF_Style_B4_Font_Colors(6) = wdColorAutomatic
Dim WrF_Style_B4_Para_Before(1 To 6) As String: WrF_Style_B4_Para_Before(1) = 0: WrF_Style_B4_Para_Before(2) = 0: WrF_Style_B4_Para_Before(4) = 12: WrF_Style_B4_Para_Before(4) = 2: WrF_Style_B4_Para_Before(5) = 0: WrF_Style_B4_Para_Before(6) = 0
Dim WrF_Style_B4_Para_After(1 To 6) As String: WrF_Style_B4_Para_After(1) = 0: WrF_Style_B4_Para_After(2) = 8: WrF_Style_B4_Para_After(3) = 0: WrF_Style_B4_Para_After(4) = 0: WrF_Style_B4_Para_After(5) = 8: WrF_Style_B4_Para_After(6) = 0
' Set Style Settings for Title, Subtitle, Heading 1, Heading 2, Normal, No Spacing
Dim WrF_Style_Font_Names(1 To 6) As String: WrF_Style_Font_Names(1) = "Arial": WrF_Style_Font_Names(2) = "Arial": WrF_Style_Font_Names(3) = "Arial": WrF_Style_Font_Names(4) = "Arial": WrF_Style_Font_Names(5) = "Times New Roman": WrF_Style_Font_Names(6) = "Times New Roman"
Dim WrF_Style_Font_Sizes(1 To 6) As Integer: WrF_Style_Font_Sizes(1) = 36: WrF_Style_Font_Sizes(2) = 32: WrF_Style_Font_Sizes(3) = 24: WrF_Style_Font_Sizes(4) = 20: WrF_Style_Font_Sizes(5) = 12: WrF_Style_Font_Sizes(6) = 12
Dim WrF_Style_Font_Bolds(1 To 6) As Boolean: WrF_Style_Font_Bolds(1) = False: WrF_Style_Font_Bolds(2) = False: WrF_Style_Font_Bolds(3) = True: WrF_Style_Font_Bolds(4) = True: WrF_Style_Font_Bolds(5) = False: WrF_Style_Font_Bolds(6) = False
Dim WrF_Style_Font_Italics(1 To 6) As Boolean: For i = 1 To 6: WrF_Style_Font_Italics(i) = False: Next i
' Colors must all be color indexes here, whereas in the B4 array they did not - it's just for reference; so wdAuto here rather than wdColorAutomatic
Dim WrF_Style_Font_Colors(1 To 6) As String: For i = 1 To 6: WrF_Style_Font_Colors(i) = wdAuto: Next i
Dim WrF_Style_Para_Before(1 To 6) As String: WrF_Style_Para_Before(1) = 12: WrF_Style_Para_Before(2) = 0: WrF_Style_Para_Before(3) = 12: WrF_Style_Para_Before(4) = 2: WrF_Style_Para_Before(5) = 0: WrF_Style_Para_Before(6) = 0
Dim WrF_Style_Para_After(1 To 6) As String: WrF_Style_Para_After(1) = 0: WrF_Style_Para_After(2) = 8: WrF_Style_Para_After(3) = 0: WrF_Style_Para_After(4) = 0: WrF_Style_Para_After(5) = 0: WrF_Style_Para_After(6) = 0
' Loop through in reverse order - in case BasedOn makes a difference
For i = 6 To 1 Step -1
ActiveDocument.Styles(WrF_Style_Names(i)).Font.Name = WrF_Style_Font_Names(i)
ActiveDocument.Styles(WrF_Style_Names(i)).Font.Size = WrF_Style_Font_Sizes(i)
ActiveDocument.Styles(WrF_Style_Names(i)).Font.Bold = WrF_Style_Font_Bolds(i)
ActiveDocument.Styles(WrF_Style_Names(i)).Font.Italic = WrF_Style_Font_Italics(i)
ActiveDocument.Styles(WrF_Style_Names(i)).Font.ColorIndex = WrF_Style_Font_Colors(i)
ActiveDocument.Styles(WrF_Style_Names(i)).ParagraphFormat.SpaceBefore = WrF_Style_Para_Before(i)
ActiveDocument.Styles(WrF_Style_Names(i)).ParagraphFormat.SpaceAfter = WrF_Style_Para_After(i)
Next i
End Sub