Characters.AddFieldEx Method
Visio Automation Reference |
Replaces the text represented by a Charactersobject with a new field of the category, code, format, language ID, and calendar ID you specify.
Version Information
Version Added: Visio 2003
Syntax
expression.AddFieldEx(Category, Code, Format, LangID, CalendarID)
expression A variable that represents a Characters object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Category | Required | VisFieldCategories | The category for the new field. |
Code | Required | VisFieldCodes | The code for the new field. |
Format | Required | VisFieldFormats | The format for the new field. |
LangID | Optional | Long | The language to use for the new field. |
CalendarID | Optional | Long | The calendar to use for the new field. |
Return Value
Nothing
Remarks
Constant values for Category, Code, and Format are declared by the Visio type library in VisFieldCategories, VisFieldCodes, and VisFieldFormats respectively.
The LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, the language ID is &H0409 for the U.S. version of Microsoft Office Visio. To see a list of possible language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.
The CalendarID argument should be one of the following values, which are declared in VisCellVals in the Visio type library. The default value is visCalWestern, which sets the calendar to the Western calendar.
Constant | Value | Description |
---|---|---|
visCalWestern |
0 |
Western |
visCalArabicHijri |
1 |
Arabic Hijiri |
visCalHebrewLunar |
2 |
Hebrew Lunar |
visCalChineseTaiwan |
3 |
Taiwan Calendar |
visCalJapaneseEmperor |
4 |
Japanese Emperor Reign |
visCalThaiBuddhism |
5 |
Thai Buddhist |
visCalKoreanDanki |
6 |
Korean Danki |
visCalSakaEra |
7 |
Saka Era |
visCalTranslitEnglish |
8 |
English transliterated |
visCalTranslitFrench |
9 |
French transliterated |
Using the AddFieldEx method is similar to clicking Field on the Insert menu and inserting any of the following categories of fields into the text:
- Date/Time
- Document Info
- Geometry
- Object Info
- Page Info
To add a custom formula field, use the AddCustomField or AddCustomFieldU method. When you do not pass values (or pass default values) for the optional LangID and CalendarID arguments, AddFieldEx acts exactly like AddField.
Example
The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddFieldEx property to format a date field in a shape. It draws a rectangle on the drawing page and then inserts a field that displays the current date in Greek, using the Western calendar.
Visual Basic for Applications |
---|
|
See Also