Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
Sets the value of a local custom field or enterprise custom field for the selected tasks or resources.
expression. SetField
( _Field_
, _Value_
, _Create_
)
expression A variable that represents an Application object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Field | Required | String | The name of the field to set. |
Value | Required | String | The value of the field. |
Create | Optional | Boolean | True if a new value is created; otherwise, False. The default value is True. |
Boolean
If the custom field uses a lookup table that does not allow additional items to be entered, the specified Value must match a predefined value in the lookup table.
If the value of the Field argument does not exist as a custom field name for the selected items, the SetField method results in run-time error 1101.
The following example sets the value of an enterprise task text custom field to one of the valid values in the lookup table for the custom field. To use the example, create a lookup table in Project Web App that includes the value Value 3, and then create a task custom text field that uses that lookup table. Select a task in the active project and run the command in the Immediate window in the Visual Basic Editor.
Application.SetField Field:="TestEntTaskText", Value:="Value 3"
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.