Create List of Local Built-in Style Names
If you are creating a Word document, a template or an add-in that is going to be used on PCs with different language versions of Microsoft Word installed, you need to pay attention to the fact that the names of the built-in styles are language-specific. This article discusses some of the problems that may occur. In addition, you can download a Word document that lets you create a list of the local built-in style names with the click of a button.
The article also includes information about the different types of styles supported by Word.
Updated 21-Aug-2020: The document you can download via this article now includes all built-in styles found in Word 2003, Word 2007, Word 2010, Word 2013, Word 2016, Word 2019, and Word for Microsoft 365 - a total of 376 styles. Note that Word 2016, Word 2019, and Word for Microsoft 365 share the same set of styles.
Problems with language-specific built-in style names
Problems in relation to STYLEREF fields
STYLEREF fields are often used to repeat e.g. document headings in the document header. This is a great feature. The syntax of the field code is:
{ STYLEREF "name of style" }
See the article STYLEREF Fields and Language-specific Style Names for information about the problems that can occur in relation to STYLEREF fields when different language versions of Word are involved and for tips on how you can overcome the problems.
Note that the article linked above explains how you can use alias style names in STYLEREF fields. You can also use alias style names in macros.
Problems in relation to macros
In macros, you may often need code that applies a style or manipulates a style. If you insert the name as a string as shown in the following example, the macro will result in an error if it is executed on a PC with a non-English version of Word installed:
ActiveDocument.Styles("Heading 2").Font.Size = 12
Fortunately, there is a solution to that problem. The WdBuiltInStyle enumeration provides constants for the built-in style names. However, Microsoft developers seem to have forgotten constant names for all new styles added in Word 2007 and later versions (but as shown below, there is also a solution in that situation). In VBA, you should always use the style name constants or the corresponding values. This way, your code will be independent of the installed language version of Word. The code line above would then look as follows:
ActiveDocument.Styles(wdStyleHeading2).Font.Size = 12
In case you need one of the built-in styles for which a name constant is missing, you can use the value instead. Actually, you could also use the value even if a name constant is found but in order to make your code easier to read and understand, I suggest you use the name constants whenever found. All built-in styles have a unique value. All the values are negative. For example, "Heading 2" has value -3. This means that the following code line would give the same result as the code samples above:
ActiveDocument.Styles(-3).Font.Size = 12
About the Word document ready for download
In order to make it easy to create a list of the local built-in style names, I have created a Word document you can download via the link below. The document contains a pre-completed 10-column table that includes the following for each built-in style – a total of 375 styles are included:
The document contains a couple of macros that can be executed via buttons in the document. Click one button and all local styles names will automatically be filled in. Another button lets you clear the local style names.
The 375 built-in styles are spread across:
You will find more details about the different style types below.
104 new styles were added in Word 2013 - they were all table styles! In Word 2016, 4 new paragraph styles have been added. The total amount of built-in table styles is huge compared to other types of styles, especially when taking into consideration that only a small part of Word users care about Table styles.
The illustration below shows page 1 of the Word document including the instruction, the buttons and the top of the table:
Follow the instructions in the document. Please note that you need to enable macros when you open the document in order to be able to use the functionality in the document. The previous version of the document was in .doc format. The updated version is in .docm format which means it cannot be used in Word 2013. The macros have been tested in Word 2007 and later versions, including Word 2016.
If you do not have access to the language version of Word for which you want to retrieve the styles names, you may send a copy of the document to somebody who has that version installed and ask him/her to run the macro, save the document and return it to you. Alternative, you may download and install the desired language pack (previously, you would have to pay for extra language packs but they are free for Word 2016).
The illustration below shows part of the table filled with Danish style names in column 10 (red font). Green color in a cell in columns 3-7 means that the style in that row is found in the Word version in question (Word 2003, Word 2007, Word 2010, Word 2013, Word 2016):
How to get the Word document with the macros
Right-click the link below to download a Word document, "Create-List-Of-BuiltIn-Styles_DocTools.docm", that lets you create a list of local built-in style names:
About the different style types in Word
The document you can download via the link above includes information about the style type for each built-in style.
When you create a new style via the user interface in Word, you can select from the style types listed in the leftmost column below.
In column 2, the VBA constant for that type of style is shown (WdStyleType Enumeration). Column 3 shows the value corresponding to the constant.
When checking for styles of a specific type in VBA, you can use either the constant or the value. Examples:
If ActiveDocument.Styles(XXX).Type = wdStyleTypeParagraph then
or
If ActiveDocument.Styles(XXX).Type = 1 then
As for the style names, your code will be easier to read and understand if you use the constants instead of the values.
Style type | VBA constant | Value | Available |
Paragraph | wdStyleTypeParagraph | 1 | All Word versions |
Character | wdStyleTypeCharacter | 2 | All Word versions |
Table | wdStyleTypeTable | 3 | All Word versions |
List | wdStyleTypeList | 4 | All Word versions |
| wdStyleTypeParagraphOnly | 5 | Added in Word 2007 |
Linked (paragraph and character) | wdStyleTypeLinked | 6 | Added in Word 2007 |
What are the differences between wdStyleTypeParagraph, wdStyleTypeParagraphOnly and wdStyleTypeLinked?
The user interface of Word does not include a style type option corresponding to wdStyleTypeParagraphOnly.
The following three lines of VBA code adds three styles of different types:
ActiveDocument.Styles.Add _
Name:="StyleType Paragraph", Type:=wdStyleTypeParagraph
ActiveDocument.Styles.Add _
Name:="StyleType ParagraphOnly", Type:=wdStyleTypeParagraphOnly
ActiveDocument.Styles.Add _
Name:="StyleType Linked", Type:=wdStyleTypeLinked
In the Styles Task Pane in Word, the three styles will look as follows:
There appears to be no difference between the styles created as wdStyleTypeParagraph and wdStyleTypeLinked. They both appear with the symbol consisting of a Pilcrow and an a: ¶a.
The style of the type wdStyleTypeParagraphOnly appears with the Pilcrow symbol only, ¶.
Styles that have the combined ¶a symbol can be applied to either entire paragraphs or be used as character styles, i.e. applied to part of a paragraph only. However, it is only possible to use such style as a character style if the option Disable Linked Styles at the bottom of the Styles Task Pane is unchecked. I recommend checking that option in general to prevent paragraph styles from being used as character styles. This makes it easier to keep a clean and consistent formatting.
If checking the style type, via VBA, of the three styles added above, the results are as follows:
Activedocument.Styles("StyleType Linked").Type
RETURNS 1 (i.e. style type wdStyleTypeParagraph)
Activedocument.Styles("StyleType Paragraph").Type
RETURNS 1 (i.e. style type wdStyleTypeParagraph)
Activedocument.Styles("StyleType ParagraphOnly").Type
RETURNS 1 (i.e. style type wdStyleTypeParagraph)
But .Linked returns values corresponding to the type shown in the Styles Task Pane, regardless of whether Disable Linked Styles is on or off:
Activedocument.Styles("StyleType Linked").Linked
RETURNS True
Activedocument.Styles("StyleType Paragraph").Linked
RETURNS True
Activedocument.Styles("StyleType ParagraphOnly").Linked
RETURNS False
What does style inspection > Reveal Formatting show?
If checking the three styles via Styles Task Pane > Inspection > Reveal Formatting, all three styles appear as Paragraph styles.
Built-in styles cannot be deleted
If you create a new blank document in Word and check which styles are found in the document, e.g. in the Organizer dialog box (can be opened via Developer tab > Document Template > Organizer button), you may only see:
But if you paste the following line in the Immediate window in the Visual Basic Editor and press Enter:
?ActiveDocument.Styles.Count
you will see a large number, e.g. 373 in case of Word 2016. This means that the document contains all those styles but they don't appear in e.g. the Organizer list unless they have been in use.
Activedocument.Styles(XXX).InUse
Oddities – three styles are missing if using a macro to list all built-in styles
If you count the styles in a blank document that has no custom styles, e.g. using the following line of code in the VBE Immediate window, the result in Word 2013 and newer versions is 373 styles.
?Activedocument.Styles.Count
373
However, note that the document you can download above includes 376 styles. If you use the macro below to list all built-in styles in a new document, you will see that the result is 373 styles – the same as above:
Sub ListAllBuiltInStyleNames() 'Create a new, blank document and insert names of all built-in styles Dim oSty As Style Dim oDoc As Document Dim n As Long n = 0 Set oDoc = Documents.Add With oDoc .Range.Text = "" For Each oSty In .Styles If oSty.BuiltIn = True Then n = n + 1 .Range.InsertAfter oSty.NameLocal & vbCr End If Next oSty End With MsgBox n & " built-in styles found.", vbOKOnly, "Names of All Built-in Style Names" Set oDoc = Nothing End Sub
If you compare the resulting style names with the list you can create using the document you can download above, you will see that the following three styles are missing when listing built-in styles using the macro above:
- z-Top of Form (# -93)
- z-Bottom of Form (# -94)
- Revision (# -179)
The styles do exist and therefore the macro above should include them in the list. But it doesn't. Maybe these styles are added for special purposes.
Translation issues in relation to style names
Over time, I have found many misleading or wrong translations in Danish versions of Word. Such issues are most likely found in other languages too. In relation to the styles names I found a really problematic translation issue:
The English style name Smart Hyperlink has been translated to Smartlink in Danish.
The English style name SmartLink has been translated to SmartLink in Danish (same as the English name).
Note that the only difference in the Danish names of the two styles is a lowercase and uppercase L. Since styles names are not case-sensitive in use, the two names are in reality identical which shouldn't be possible. If you, for example, type "SmartLink" in the Apply Styles dialog box, the style Smartlink is applied. You can't apply SmartLink (with the uppercase L) unless you select it directly from the style list somewhere.
If you type "smartlink" or another variation that does not match one of the two style names exactly, Word shows an error message, telling that "smartlink refers to more than one style" (see illustration below):
Related information
Via the link below, you can download a PDF document that contains the style names of almost 140 built-in styles in English, Danish, German and French (the style list does not include styles added in Word 2013 and newer versions):
Word Style Names in English, Danish, German, French.
See also the article STYLEREF Fields and Language-specific Style Names.