PRJ: FilterApply Method Fails with Two Interactive Dialog BoxesLast reviewed: November 24, 1997Article ID: Q113772 |
The information in this article applies to:
SYMPTOMSIn 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.
CAUSEThe syntax for the FilterApply method is as follows:
FilterApply name, highlight, value1, value2The 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.
WORKAROUNDSTo 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 boxesUse 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 boxesIf 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.
MORE INFORMATION
Steps to Reproduce Behavior
REFERENCESFor additional information, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID: Q126941 TITLE : Creating a Multi-Line Filter Using the FilterEdit MethodFor more information about the FilterApply Method, choose the Search button in the Visual Basic reference and type:
FilterApplyFor more information about the FilterEdit Method, choose the Search button in the Visual Basic reference and type:
FilterEdit |
Additional query words: 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |