Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.FilterEdit Method (Project)

office 365 dev account|Last Updated: 10/19/2017
|
2 Contributors

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

NameRequired/OptionalData TypeDescription
NameRequiredStringThe name of a filter to edit, create, or copy.
TaskFilterRequiredBooleanTrue if the filter specified with Name contains task information. False if the filter contains resource information.
CreateOptionalBooleanTrue 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 by Name. The default value is False.
OverwriteExistingOptionalBooleanTrue if the existing filter is overwritten with a new filter. The default value is False.
ParenthesisOptionalBooleanTrue 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.
NewNameOptionalStringA 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.
FieldNameOptionalStringThe name of a field to change.
NewFieldNameOptionalStringA new name for the field specified with FieldName.
TestRequiredStringThe type of comparison made between FieldName and Value that acts as selection criteria for the filter. Can be one of the comparison strings.
ValueOptionalStringThe value to compare with the value of the field specified with FieldName.
OperationOptionalStringHow 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".
ShowInMenuOptionalBooleanTrue if the filter is displayed in the Filter drop-down list. The default value is False. Note To display the list of filters, on the Ribbon, on the View tab, click the Filter drop-down list.
ShowSummaryTasksOptionalBooleanTrue if the summary tasks of the filtered tasks are displayed. The default value is False.


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.

Return value

Boolean

Example

The following example creates a filter (if one does not exist) for tasks with the highest priority, and then applies the filter.

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 does not 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 FilterEdit Name:="Highest Priority", _ 
        Create:=True, TaskFilter:=True, FieldName:="Priority", _ 
        Test:="equals", Value:="Highest" 
    FilterApply "Highest Priority" 
End Sub    
© 2018 Microsoft