
Tips.Net > WordTips Home > Formatting > Styles > Printing a List of Custom Styles
Summary: Printing a style list is easy in Word—it is done right from the Print dialog box. If you want to print a list of your custom styles, then it isn’t so easy. This tip provides a macro you can use to get just the style list you need. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
Word allows you to create styles to define how the text in your document should appear. Besides a full list of built-in styles, Word allows you to create any custom styles that you may desire. You can later print a style sheet for your document, as described in other issues of WordTips.
What if you want a list of only custom styles, however? Word doesn't include a feature that allows you to discriminate on which styles are included in a style sheet printout. If you want a list of custom styles that are being used in a document, you can create one by using a macro. The following macro steps through all the styles and compiles a list of those that meet both criteria:
Sub PrintCustomStyles()
Dim docThis As Document
Dim styItem As Style
Dim sUserDef(499) As String
Dim iStyleCount As Integer
Dim J As Integer
' Ref the active document
Set docThis = ActiveDocument
iStyleCount = 0
For Each styItem In docThis.Styles
'see if being used
If styItem.InUse Then
'make sure not built in
If Not styItem.BuiltIn Then
iStyleCount = iStyleCount + 1
sUserDef(iStyleCount) = styItem.NameLocal
End If
End If
Next styItem
' Create the output document
Documents.Add
Selection.TypeText "User-defined Styles In Use"
Selection.TypeParagraph
For J = 1 To iStyleCount
Selection.TypeText sUserDef(J)
Selection.TypeParagraph
Next J
Selection.TypeParagraph
Selection.TypeParagraph
End Sub
Remember that there is a difference between "custom styles" and "customized styles." (A built-in style can be a customized style, if you change the default characteristics of the style.) This macro prints a list of custom styles; it completely ignores those styles that Word considers built-in.
Tip #1530 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Create and Merge! Discover how to use Word's mail merge tool to create your own custom documents. WordTips: Mail Merge Magic includes all the information you need to make your merges more productive.
Have thousands of WordTips at your fingertips, on your own system. Answer your own questions or help support others. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Pet Tips
Word2007 Tips
WordTips