Office Settings & Configuration

Insert a Named LISTNUM Field in Microsoft Word Using VBA

John WilsonJohn Wilson Nov 20, 2026 868 views

Question details

Insert a LISTNUM field associated with a named multilevel list at the end of a selection using Word VBA.

Insert a Named LISTNUM Field in Word Using VBA
Product
Microsoft Word
Device & OS
not provided
Scenario
A user wants a VBA macro to insert a numbering field that refers to an existing named list.
Observed behavior
The LISTNUM field should be inserted at the end of the selection and use the specified list name.
Before you start

Identify the exact name of the existing list you want the LISTNUM field to use. Open the document in desktop Word and make sure you can access the VBA editor and run trusted macros.

Solution 1Recommended

Insert the LISTNUM field with the list name in Word VBA

Use the Fields.Add method to insert a LISTNUM field at the end of the current selection and specify the list name in its Text argument.

1
Open the VBA editor

In desktop Word, open the VBA editor. On Windows, press Alt+F11, then choose Insert > Module.

2
Add the macro

Paste this code into the module: Sub InsertNamedListNum() Selection.Collapse Direction:=wdCollapseEnd ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldListNum, Text:="CommProp" End Sub

3
Set the list name

In the code, replace CommProp with the exact name of your defined list, keeping the quotation marks.

4
Select the insertion point and run

Return to the document and select the text after which you want the field inserted, or place the cursor at the insertion point. Open the Macros dialog, select InsertNamedListNum, and click Run.

Insert the LISTNUM field with the list name in Word VBA
How the selection is used: The macro collapses the selection to its end before adding the field, so the selected text is not replaced.
Free Microsoft Office alternative

Work with Word documents in WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface and support for Word documents, making it easy to move everyday editing work to WPS Writer. The Word VBA macro in this guide is specific to Microsoft Word.

Edit numbered documents in WPS WriterOpen and save Microsoft Word DOCX and DOC filesUse a familiar word-processing interfaceMove everyday document editing to a lightweight office suite
QA img-9

Frequently Asked Questions

Where do I put the named list in the VBA code?

Set the Text argument in ActiveDocument.Fields.Add to the exact list name, for example, Text:="CommProp".

Will the macro replace my selected text?

No. Selection.Collapse Direction:=wdCollapseEnd moves the insertion point to the end of the selection before the field is added.

How can I update the inserted field?

In Word, select the field and press F9 to update it.

Can WPS Writer run this Microsoft Word VBA macro?

This macro uses the Microsoft Word object model and is intended for desktop Word. WPS Writer can edit Word documents, but compatibility with this specific macro should not be assumed.