Update a Word Style and Numbering List Template with VBA
Question details
The user needs to update a Word style and its associated numbering list template with VBA.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- A macro needs to change the numbering levels used by a style, but similar templates appear in the numbering gallery.
- Observed behavior
- The active list template is not always obvious when a numbering gallery item is modified.
Open a test copy of the document and place the cursor in a paragraph that uses the numbered style you want to change. Confirm whether the list is single-level or multilevel before working with the numbering gallery.
Get the List Template from the Selected Numbered Paragraph
Use the selected paragraph to identify its applied list template instead of guessing from the gallery.
Changes to a list template can affect other paragraphs that use the same template. The example changes level 1 and links an existing style to that level.
In Word, click inside a paragraph that already uses the target numbering and style.
Open Developer > Visual Basic, then choose Insert > Module in the VBA editor.
Enter the following macro, replacing MyNumberedStyle with the name of an existing style: Sub UpdateSelectedList() Dim lt As ListTemplate On Error Resume Next Set lt = Selection.Range.ListFormat.ListTemplate On Error GoTo 0 If lt Is Nothing Then MsgBox "Select a numbered paragraph first." Exit Sub End If lt.ListLevels(1).NumberFormat = "%1." ActiveDocument.Styles("MyNumberedStyle").LinkToListTemplate ListTemplate:=lt, ListLevelNumber:=1 End Sub
Run UpdateSelectedList from the VBA editor, then inspect the numbered paragraphs in Word. Adjust the ListLevels index and NumberFormat in the macro to match the intended level and format.

Reset the Word Numbering Gallery to Test a List Template
Try this workaround when similar gallery entries make the intended template difficult to identify.
Edit Numbered Documents with WPS Writer
WPS Office is a free, lightweight alternative for editing documents in a familiar interface. Open Word files in WPS Writer and work with styles and numbered lists while migrating documents between office suites. It does not fix Microsoft Word's VBA gallery behavior.

Frequently Asked Questions
How can I find the list template used by a Word paragraph?
Click inside the numbered paragraph and use Selection.Range.ListFormat.ListTemplate in the VBA editor. Check that the returned reference is not Nothing before modifying it.
Does ListTemplates(1) always refer to the active list?
No. Gallery indexes can vary between documents and Word versions. Inspect the template and its ListLevels before using it to change numbering.
How do I link a Word style to a numbering level in VBA?
Use the style's LinkToListTemplate method with a verified ListTemplate reference and the intended ListLevelNumber. The style must already exist in the document.
What happens if I change a shared list template?
Other paragraphs that use that template may also change. Run the macro on a test copy and inspect the affected numbered paragraphs afterward.




