Task.Name 專案) (屬性

取得或設定 Task 物件的名稱。 讀取/寫入的 String

語法

運算式名字

表達 代表 Task 物件的變數。

範例

下面範例會顯示包含指定文字的任務名稱。

Sub NameExample() 
    Dim t As Task 
    Dim x As String 
    Dim y As String 
 
    x = InputBox$("Search for tasks that include the following text in their names:") 
 
    If Not x = "" Then 
        For Each t In ActiveProject.Tasks 
            If InStr(1, t.Name, x, 1) Then 
                y = y & vbCrLf & t.ID & ": " & t.Name 
            End If 
        Next t 
 
        If Len(y) = 0 Then 
            MsgBox "No tasks with the text " & x & " found in the project", vbExclamation 
        Else 
            MsgBox y 
        End If 
    End If 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應