Andrei Zakharov said:
Oops, silly me
Though the VBA doc isn't clear enough of how to create
complex filters, I mean usage of Parenthesis and Operation parameters, but
using of macro recording and Project/Filtered for dialog can get an
understanding of the stuff.
Thanks to all.
Andrei.
Andrei,
Ok, I'm glad we got that cleared up. You are right in that the Object
Browser isn't very thorough in explaining how to develop complex
filters. Below is an example of a complex filter from one of my macros.
It even includes some logic as part of the filter development. And yes,
it took me quite a while to figure it all out, but one good way to get
things started is to manually record a macro while a complex filter is
built. Then look at the resulting code and adjust accordingly.
'Structure variable filter based on user option inputs
' first line in filter is a placeholder for the 'create' and
'overwriteexisting' options in the FilterEdit syntax
' and it will also filter out any blank lines (don't need a "If Not t
is Nothing" Then statement)
FilterEdit Name:="CobraX", taskfilter:=True, create:=True,
overwriteexisting:=True, _
FieldName:="summary", test:="equals", Value:="no",
ShowInMenu:=False, showsummarytasks:=False
FilterEdit Name:="CobraX", taskfilter:=True, operation:="and", _
parenthesis:=True, newfieldname:="start", test:="is greater than or
equal to", Value:=SDate
FilterEdit Name:="CobraX", taskfilter:=True, _
operation:="or", newfieldname:="finish", test:="is greater than or
equal to", Value:=SDate
If OLFlag = True Then FilterEdit Name:="CobraX", taskfilter:=True,
operation:="and", _
parenthesis:=True, newfieldname:="outline level", test:="is less
than or equal to", _
Value:=frmCobra.TxBoxOutlineLvl.Value
If WBSFlag = True Then FilterEdit Name:="CobraX", taskfilter:=True,
operation:="and", _
parenthesis:=True, newfieldname:="Flag20", test:="equals",
Value:="yes"
FilterApply Name:="CobraX"
John
Project MVP