Characters.AddField method (Visio)

Replaces the text represented by a Characters object with a new field of the category, code, and format you specify.


expression.AddField (Category, Code, Format)

expression A variable that represents a Characters object.


Name Required/Optional Data type Description
Category Required Integer VisFieldCategories. The category for the new field.
Code Required Integer VisFieldCodes. The code for the new field.
Format Required Integer VisFieldFormats. The format for the new field.

Return value



Using the AddField method is similar to clicking Field on the Insert tab and inserting any of the following categories of fields in the text:

  • Date/Time

  • Document Info

  • Geometry

  • Object Info

  • Page Info

To add a custom formula field, use the AddCustomField method.

To specify language and calendar versions for Date/Time fields, use the AddFieldEx method.

Constant values for Category, Code, and Format are declared by the Visio type library in VisFieldCategories, VisFieldCodes, and VisFieldFormats respectively.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.