Szerkesztés

Megosztás a következőn keresztül:


Resource.GetField method (Project)

Returns the value of the specified resource custom field.

Syntax

expression. GetField( _FieldID_ )

expression A variable that represents a Resource object.

Parameters

Name Required/Optional Data type Description
FieldID Required Long For a local custom field, can be one of the PjField constants for resource custom fields. For an enterprise custom field, use the FieldNameToFieldConstant method to get the FieldID.

Return value

String

Example

The following example displays the value of a local resource custom field specified by the user.

Sub DisplayField() 
    Dim Temp As String 
 
    Temp = InputBox$("Enter the name of the field you want to see:") 
    Temp = LCase(Temp) 
 
    Select Case Temp 
        Case "name" 
            MsgBox (ActiveCell.Resource.GetField(FieldID:=pjResourceName)) 
        Case "initials" 
            MsgBox (ActiveCell.Resource.GetField(FieldID:=pjResourceInitials)) 
        Case "standard rate" 
            MsgBox (ActiveCell.Resource.GetField(FieldID:=pjResourceStandardRate)) 
        Case "" 
            End 
        Case Else 
            MsgBox "You entered an invalid field. Please try again." 
            End 
    End Select 
End Sub

For an example that uses an enterprise resource custom field, see the SetField method.

Support and feedback

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.