Creating Filters

S

Shane

Is it possible to create filters from scratch in VBA? For example, I want to
filter on all tasks with this filter: Mid([Name],9,6) = "Record". Another
example would be: Mid([EnterpriseTaskText11],4,2) <> 00. This would include
01.01.00, 10.05.10, etc. but would not include 01.00.00 or 16.00.27. If I
can't create filters this way, then I'm forced to place these formulas in
custom fields. This would eat up the custom fields quickly.

If I can't create filters, can I programmatically place formulas in fields,
then have them calculate? This way, I can designate a handful of fields to be
used only for these types of formulas. They are populated according to the
procedure that is run.

Any suggestions?
 
R

Rod Gill

I don't think you can use those formulae in filters. You therefore need an
intermediate custom field.

Alternatively you can do the test in VBA and reuse Flag1 and have one Flag1
Filter.

To get VBA code for creating a filter and formula, record a macro of you
creating them manually.
 
J

John

Rod Gill said:
I don't think you can use those formulae in filters. You therefore need an
intermediate custom field.

Alternatively you can do the test in VBA and reuse Flag1 and have one Flag1
Filter.

To get VBA code for creating a filter and formula, record a macro of you
creating them manually.

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more

Rod,
Actually "formulas" can be used in filters in an indirect way. I simply
set up a variable and then filter. For example, I have a macro that gets
input options from the user via a userform although the variables could
also be determined by earlier code in the procedure.
OLOpt = [appropriate test]
OLevel = [some value]
FilterEdit Name:="Test", taskfilter:=True, _
newfieldname:="outline level", test:=OLOpt, Value:=OLLevel

However, looking at the two examples Shane gave, there is no need for a
formula. In both cases he could simply use a "contains" filter on the
Name field and EnterpriseTaskText11 field.

John
Project MVP
Shane said:
Is it possible to create filters from scratch in VBA? For example, I want
to
filter on all tasks with this filter: Mid([Name],9,6) = "Record". Another
example would be: Mid([EnterpriseTaskText11],4,2) <> 00. This would
include
01.01.00, 10.05.10, etc. but would not include 01.00.00 or 16.00.27. If I
can't create filters this way, then I'm forced to place these formulas in
custom fields. This would eat up the custom fields quickly.

If I can't create filters, can I programmatically place formulas in
fields,
then have them calculate? This way, I can designate a handful of fields to
be
used only for these types of formulas. They are populated according to the
procedure that is run.

Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top