Office Settings & Configuration

Update a Word Style and Numbering List Template with VBA

Aamir Naveed AkramAamir Naveed Akram Nov 27, 2026 869 views

Question details

The user needs to update a Word style and its associated numbering list template with VBA.

Update a Word Style and 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.
Before you start

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.

Solution 1Recommended

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.

1
Select a numbered paragraph

In Word, click inside a paragraph that already uses the target numbering and style.

2
Open the VBA editor

Open Developer > Visual Basic, then choose Insert > Module in the VBA editor.

3
Add the macro

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

4
Run and check the macro

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.

Get the List Template from the Selected Numbered Paragraph
Free Microsoft Office alternative

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.

Work with numbered lists and document styles in WPS WriterOpen and save Microsoft Word DOC and DOCX filesUse a familiar interface for everyday document editingMove existing documents to a free, lightweight office suite
microsoft office alternative - wps office

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.