Table of contents
TOC
Collapse the table of content
Expand the table of content

Resource.GetField Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Returns the value of the specified resource custom field.

Syntax

expression. GetField( ** FieldID** )

expression A variable that represents a Resource object.

Parameters

NameRequired/OptionalData TypeDescription
FieldIDRequiredLongFor 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.

© 2018 Microsoft