Insert a Named LISTNUM Field in Microsoft Word Using VBA
Question details
Insert a LISTNUM field associated with a named multilevel list at the end of a selection using Word 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.
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.
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.
In desktop Word, open the VBA editor. On Windows, press Alt+F11, then choose Insert > Module.
Paste this code into the module: Sub InsertNamedListNum() Selection.Collapse Direction:=wdCollapseEnd ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldListNum, Text:="CommProp" End Sub
In the code, replace CommProp with the exact name of your defined list, keeping the quotation marks.
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.

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.

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.




