How do I get filters to work in a custom macro in Project 2003?

D

Dr WPK

Ultimately I am trying to automate output of several custom reports.
However, the custom reports do not print in "outline" format (despite my
checking that specific box). So, I opted for using custom macros to get the
information views I want (like "Pending Tasks" or "Current Week's Tasks",
etc.) But, even though I set a filter condition like "not equal to 100%",
the macro, when it's run, only gets to the point of turning on the filter,
but doesn't actually select the condition(s) I specified originally. Once I
can get the views, then it's easy to send the view to the printer. But, I
can't get the filtering conditions to be "followed" by the custom macro.
Please advise.
 
J

John

Dr WPK said:
Ultimately I am trying to automate output of several custom reports.
However, the custom reports do not print in "outline" format (despite my
checking that specific box). So, I opted for using custom macros to get the
information views I want (like "Pending Tasks" or "Current Week's Tasks",
etc.) But, even though I set a filter condition like "not equal to 100%",
the macro, when it's run, only gets to the point of turning on the filter,
but doesn't actually select the condition(s) I specified originally. Once I
can get the views, then it's easy to send the view to the printer. But, I
can't get the filtering conditions to be "followed" by the custom macro.
Please advise.

Dr WPK,
Without actually seeing your code it is difficult to tell what might be
happening. And, you don't mention if the code just stops, if you get an
error message, etc.

John
Project MVP
 
D

Dr WPK

I guess that the "code" just stops. I used the default macro functionality
to record my mouse movements and clicks and keyboard strokes, including the
filter issue I mentioned, where I set the "% Complete" not equal to 100%. I
am not a VB programmer, and so have not modified the code from whatever the
macro recorded. If you need to see the code, I need to know how to post it
here for you. Thanks for the response.
 
D

Dr WPK

I just found a way to see the VB code, which should help you:

Sub Overdue_Tasks()
' Macro Overdue_Tasks
' Macro Recorded Thu 9/1/05 by wknowles.
ViewApply Name:="&Gantt Chart"
OutlineShowAllTasks
AutoFilter
End Sub

As you can see, once I click on the Filter button, nothing else gets
recorded in the macro (thus explaining why the functionality I am expecting
never occurs). Please advise how to activate the macro to capture my filter
choices. Thx.
 
S

Sarah

The AutoFilter button will not work with VBA. You will need to create a
custom filter to show the data you want, then use THAT filter in your
VBA module.

Sarah K
 
J

John

Dr WPK said:
I just found a way to see the VB code, which should help you:

Sub Overdue_Tasks()
' Macro Overdue_Tasks
' Macro Recorded Thu 9/1/05 by wknowles.
ViewApply Name:="&Gantt Chart"
OutlineShowAllTasks
AutoFilter
End Sub

As you can see, once I click on the Filter button, nothing else gets
recorded in the macro (thus explaining why the functionality I am expecting
never occurs). Please advise how to activate the macro to capture my filter
choices. Thx.

Dr WPK,
I've never used the AutoFilter feature but as Sarah indicated, not
everything in Project is available via VBA. On the other hand, there are
some things that can be obtained via VBA that are not possible any other
way.

Your needs sound simple enough. If you tell me specifically what you
need, I can create a little macro for you. It might be easiest if you
write me direct.

John
Project MVP
 

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