Share via


Characters.AddField Method

Visio Automation Reference

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

Version Information
 Version Added:  Visio 3.0

Syntax

expression.AddField(Category, Code, Format)

expression   A variable that represents a Characters object.

Parameters

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
Nothing

Remarks

Using the AddField method is similar to clicking Field on the Insert menu 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 AddCustomFieldmethod.

To specify language and calendary 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.

See Also