
Originally Posted by
macropod
Conditionally creating Styles is the easy part - you'd also need to define their parameters (e.g. font name, size, italics, etc.; paragraph alignment, indents, before/after spacing, etc) before they'd be much use. The best course is to make sure you use a template containing all the Styles you need. You can specify the template via the existing .Documents.Add line. For example:
.Documents.Add Template:="C:\File_Path\Template_Name.dotx"
Yes found the code
X = ActiveDocument.Styles.Count
For i = 1 To X
If "DeleteStyle" = ActiveDocument.Styles(i) Then
GoTo CONTINUE ' ****** We'll skip if style already present **********
End If
Next
' ************ If we dropped to here -- we need to create the new style ********
ActiveDocument.Styles.Add Name:="DeleteStyle", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("DeleteStyle")
.AutomaticallyUpdate = False
.BaseStyle = "Normal" ' ******* Start with normal and vary it from there
.NextParagraphStyle = "DeleteStyle"
End With
' *********** Deefining the particular style **********
With ActiveDocument.Styles("DeleteStyle").Font
.Bold = True
.ColorIndex = wdRed
End With
CONTINUE:
Thank you!
Haven't tested but seems fine