Inserts a Microsoft field in a document.
Syntax
|
CHGVAR |
VAR(&CMD) VALUE('WFIELDS') |
|
CHGVAR |
VAR(&PARM1) VALUE(' Text="Expression
to insert" ') |
|
CHGVAR |
VAR(&PARM2) VALUE(' ') |
|
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
|
Parameters |
|
|
Parm1 |
Text = Additional text for the creation of the field.
Type = Type
of field to add. (Default = wdFieldTypeEmpty).
Bookmark = indicates an existing document bookmark, where new field must be inserted.
PreserveFormat = allows to preserve field format when updating.
Update = updates all document fields.
|
|
|
Note
Accepted values for the field type:
|
wdFieldAddin |
wdFieldAdvance |
wdFieldAsk |
|
wdFieldAuthor |
wdFieldAutoNum |
wdFieldAutoNumLegal |
|
wdFieldAutoNumOutline |
wdFieldAutoText |
wdFieldAutoTextList |
|
wdFieldBarCode |
wdFieldComments |
wdFieldCompare |
|
wdFieldCreateDate |
wdFieldData |
wdFieldDatabase |
|
wdFieldDate |
wdFieldDDE |
wdFieldDDEAuto |
|
wdFieldDocProperty |
wdFieldDocVariable |
wdFieldEditTime |
|
wdFieldEmbed |
wdFieldEmpty |
wdFieldExpression |
|
wdFieldFileName |
wdFieldFileSize |
wdFieldFillIn |
|
wdFieldFootnoteRef |
wdFieldFormCheckBox |
wdFieldFormDropDown |
|
wdFieldFormTextInput |
wdFieldFormula |
wdFieldGlossary |
|
wdFieldGotoButton |
wdFieldHTMLActiveX |
wdFieldHyperlink |
|
wdFieldIf |
wdFieldImport |
wdFieldInclude |
|
wdFieldIncludePicture |
wdFieldIncludeText |
wdFieldIndex |
|
wdFieldIndexEntry |
wdFieldInfo |
wdFieldKeyWord |
|
wdFieldLastSavedBy |
wdFieldLink |
wdFieldListNum |
|
wdFieldMacroButton |
wdFieldMergeField |
wdFieldMergeRec |
|
wdFieldMergeSeq |
wdFieldNext |
wdFieldNextIf |
|
wdFieldNoteRef |
wdFieldNumChars |
wdFieldNumPages |
|
wdFieldNumWords |
wdFieldOCX |
wdFieldPage |
|
wdFieldPageRef |
wdFieldPrint |
wdFieldPrintDate |
|
wdFieldPrivate |
wdFieldQuote |
wdFieldRef |
|
wdFieldRefDoc |
wdFieldRevisionNum |
wdFieldSaveDate |
|
wdFieldSection |
wdFieldSectionPages |
wdFieldSequence |
|
wdFieldSet |
wdFieldSkipIf |
wdFieldStyleRef |
|
wdFieldSubject |
wdFieldSubscriber |
wdFieldSymbol |
|
wdFieldTemplate |
wdFieldTime |
wdFieldTitle |
|
wdFieldTOA |
wdFieldTOAEntry |
wdFieldTOC |
|
wdFieldTOCEntry |
wdFieldUserAddress |
wdFieldUserInitials |
|
wdFieldUserName |
|
|
Examples
This example adds the variable field "Variable1" and assigns it the value "Sir".
Quotation marks are doubled around the value.
|
CHGVAR |
VAR(&CMD) VALUE('WFIELDS') |
|
CHGVAR |
VAR(&PARM1)
VALUE('Text="SET Variable1 ""Sir""" ; + |
|
CHGVAR |
VAR(&PARM2) VALUE(' ') |
|
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
In this example all document fields are updated.
|
CHGVAR |
VAR(&CMD) VALUE('WFIELDS') |
|
CHGVAR |
VAR(&PARM1) VALUE('Update =True') |
|
CHGVAR |
VAR(&PARM2) VALUE(' ') |
|
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Finally this example creates a bookmark and assigns a merge field named CUST_ID on this bookmark:
LNCCMD CMD(WBOOKMADD) +
PARM1('BOOKMARK="Name";TEXT="Aura"')
LNCCMD CMD(WFIELDS) +
PARM1('Text="CUST_ID";Type=wdFieldMergeField;Bookmark="Name"')