AddField method

Microsoft Visio Developer Reference

AddField method

   Example   

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

Version added

3.0

Syntax

object.AddField intCategory, intCode, intFormat

object

Required. An expression that returns a Characters object.

intCategory

Required Integer. The category for the new field.

intCode

Required Integer. The code for the new field.

intFormat

Required Integer. The format for the new field.

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 AddCustomField method.

For intCategory, intCode, and intFormat constant values, see the FieldCategory, FieldCode, and FieldFormat property topics. These constants are also declared by the Visio type library in VisFieldCategories, VisFieldCodes, and VisFieldFormats.