Resource.GetField 方法 (Project)

返回指定的资源自定义域的值。

语法

expressionGetField( _FieldID_ )

表达 一个代表 Resource 对象的变量。

参数

名称 必需/可选 数据类型 说明
FieldID 必需 Long 对于本地自定义字段,可以是资源自定义域的 PjField 常量之一。 对于企业自定义字段,使用 FieldNameToFieldConstant 方法来获取 FieldID。

返回值

String

示例

以下示例显示用户指定的一个本地资源自定义域的值。

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

有关使用企业资源自定义域的示例,请参阅 SetField 方法。

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。