共用方式為


Project) (Resource.GetField 方法

會傳回指定之資源自訂欄位的值。

語法

expressionGetField( _FieldID_ )

表達 代表 Resource 物件的變數。

參數

名稱 必要/選用 資料類型 描述
FieldID 必要 Long 為本機自訂欄位可以是 PjField 常數的資源自訂欄位。 企業自訂欄位,使用 FieldNameToFieldConstant 方法來取得 FieldID。

傳回值

字串

範例

下列範例會顯示使用者所指定之本機資源欄位的值。

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 支援與意見反應