Share via


Application.FilterEdit Method

Project Developer Reference

Creates, edits, or copies a filter.

Syntax

expression.FilterEdit(Name, TaskFilter, Create, OverwriteExisting, Parenthesis, NewName, FieldName, NewFieldName, Test, Value, Operation, ShowInMenu, ShowSummaryTasks)

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
Name Required String The name of a filter to edit, create, or copy.
TaskFilter Required Boolean True if the filter specified with Name contains task information. False if the filter contains resource information.
Create Optional Boolean True if a new filter is created. The new filter is a copy of the filter specified with Name and is given the name specified with NewName. If NewName is Empty, the new filter is given the name specified with Name. The default value is False.
OverwriteExisting Optional Boolean True if the existing filter is overwritten with a new filter. The default value is False.
Parenthesis Optional Boolean True if the criterion established by FieldName, Test, and Value is evaluated as a parenthetical AND or OR clause (the value specified with Operation) in relation to other criteria, in the manner of (a AND b) OR c.
NewName Optional String A new name for the filter specified with Name (Create is False) or a name for the new filter (Create is True). If NewName is Empty and Create is False, the filter specified with Name retains its current name. The default value is Empty.
FieldName Optional String The name of a field to change.
NewFieldName Optional String A new name for the field specified with FieldName.
Test Required String The type of comparison made between FieldName and Value that acts as selection criteria for the filter. Can be one of the following comparison strings:
Comparison StringDescription
"equals"The value of FieldName equals Value.
"does not equal"The value of FieldName does not equal Value.
"is greater than"The value of FieldName is greater than Value.
"is greater than or equal to"The value of FieldName is greater than or equal to Value.
"is less than"The value of FieldName is less than Value.
"is less than or equal to"The value of FieldName is less than or equal to Value.
"is within"The value of FieldName is within Value.
"is not within"The value of FieldName is not within Value.
"contains"FieldName contains Value.
"does not contain"FieldName does not contain Value.
"contains exactly"FieldName exactly contains Value.
Comparison String Description
"equals" The value of FieldName equals Value.
"does not equal" The value of FieldName does not equal Value.
"is greater than" The value of FieldName is greater than Value.
"is greater than or equal to" The value of FieldName is greater than or equal to Value.
"is less than" The value of FieldName is less than Value.
"is less than or equal to" The value of FieldName is less than or equal to Value.
"is within" The value of FieldName is within Value.
"is not within" The value of FieldName is not within Value.
"contains" FieldName contains Value.
"does not contain" FieldName does not contain Value.
"contains exactly" FieldName exactly contains Value.
Value Optional String The value to compare with the value of the field specified with FieldName.
Operation Optional String How the criterion established with FieldName, Test, and Value relates to other criteria in the filter. The Operation argument can be set to "And" or "Or".
ShowInMenu Optional Boolean True if the filter is displayed in the Filters menu. (To display the Filters menu, click Filtered for on the Project menu.) The default value is False.
ShowSummaryTasks Optional Boolean True if the summary tasks of the filtered tasks are displayed. The default value is False.

Return Value
Boolean

Example
The following example creates a filter (if one doesn't exist) for tasks with the highest priority and then applies the filter.

Visual Basic for Applications
  Sub CreateAndApplyHighestPriorityFilter()
Dim TaskFilter As Variant  ' Index for For Each loop
Dim Found As Boolean    ' Whether or not the filter exists.

Found = False   ' Assume the filter doesn't exist.

' Look for filter.
For Each TaskFilter In ActiveProject.TaskFilterList
    If TaskFilter = "Highest Priority" Then
        Found = True
        Exit For
    End If
Next TaskFilter

' If filter doesn't exist, create it.
If Not Found Then <strong class="bterm">FilterEdit</strong> Name:="Highest Priority", _
    Create:=True, TaskFilter:=True, FieldName:="Priority", _
    Test:="equals", Value:="Highest"

FilterApply "Highest Priority"

End Sub

See Also