Share via


Name Property

Returns the name of an Application, Calendar, CostRateTable, Day, Filter, Group, LookupTableEntry, Month, OutlineCode, Profile, Project, Resource, Table, Task, View, Weekday, or Year object. Read-only String.

Remarks

The Name property is supported read/write for the Calendar, Filter, Group, LookupTableEntry, OutlineCode, Profile, Resource, Table, Task, View, ViewCombination, and ViewSingle objects.

Example

The following example displays the task names that contain the specified text.

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

Applies to | Calendar Object, Calendars Collection Object | CostRateTable Object, CostRateTables Collection Object | Day Object, Days Collection Object | Filter Object, Filters Collection Object | Group Object, Groups Collection Object | LookupTableEntry Object | Month Object, Months Collection Object | OutlineCode Object, OutlineCodes Collection Object | Profile Object, Profiles Collection Object | Resource Object, Resources Collection Object | Table Object, Tables Collection Object | Task Object, Tasks Collection Object | View Object, Views Collection Object | ViewCombination Object, ViewsCombination Collection Object | ViewSingle Object, ViewsSingle Collection Object | WeekDay Object, WeekDays Collection Object | Year Object, Years Collection Object

See Also | Code Property | CodeName Property | FullName Property | Group Property | HasPassword Property | Initials Property | OperatingSystem Property | Path Property | Priority Property | ReadOnly Property | ReadOnlyRecommended Property | Saved Property | WBS Property