PRJ: FilterApply Method Fails with Two Interactive Dialog Boxes (113772)
The information in this article applies to:
- Microsoft Project 98 for Windows
- Microsoft Project for Windows 95 4.1
- Microsoft Project for Windows 95 4.1a
- Microsoft Project for Windows 4.0
- Microsoft Project for the Macintosh 4.0
This article was previously published under Q113772 SYMPTOMS
In Microsoft Project, when you use the FilterApply method in a macro to
apply a filter that displays multiple interactive dialog boxes, tasks that
meet the criteria are not displayed.
CAUSE
The syntax for the FilterApply method is as follows:
FilterApply name, highlight, value1, value2
The value1 and value2 arguments of the FilterApply method are string
expressions that specify the first and second value to use when you apply
an interactive filter. However, these arguments represent values in the
same interactive filter dialog box in an interactive filter that displays
only two fields. These arguments do not work as the first and second values
for a filter that displays two different interactive dialog boxes. You
cannot specify values for more than one interactive dialog box using the
FilterApply method in a macro.
For example, when you apply the Date Range filter, one dialog appears
asking for the Start or Finish After criteria, and a second dialog appears
asking for the Before criteria. You cannot use the value1 argument of the
FilterApply method for the After criteria, and the value2 argument for the
Before criteria.
WORKAROUND
To apply a filter that uses multiple interactive dialog boxes, and to
supply the criteria using a macro, use either of the following workarounds.
To apply the filter and display the interactive dialog boxes
Use a SendKeys statement to enter the criteria values, as in the following
example:
Sub Apply_Filter1()
' Send the criteria dates and ENTER keys
' to use with the Date Range filter
SendKeys "11/1{ENTER}12/1{ENTER}"
' Apply the Date Range filter
FilterApply Name:="Date Range..."
End Sub
To apply the filter without displaying dialog boxes
If you want to apply a filter without displaying the dialog boxes, use the
FilterEdit method to create a new filter or customize an existing filter.
Then, use the FilterApply method to apply this new or customized filter.
Microsoft provides examples of Visual Basic procedures for illustration
only, without warranty either expressed or implied, including but not
limited to the implied warranties of merchantability and/or fitness for a
particular purpose. This Visual Basic procedure is provided 'as is' and
Microsoft does not guarantee that it can be used in all situations.
Microsoft does not support modifications of this procedure to suit customer
requirements for a particular purpose.
REFERENCES
For additional information, please see the following article(s) in the
Microsoft Knowledge Base:
126941 Creating a Multi-Line Filter Using the FilterEdit Method
For more information about the FilterApply Method, choose the Search
button in the Visual Basic reference and type:
For more information about the FilterEdit Method, choose the Search
button in the Visual Basic reference and type:
Modification Type: | Major | Last Reviewed: | 11/25/2003 |
---|
Keywords: | kbcode kbprb kbProgramming KB113772 |
---|
|