Printing Multiple Filtered data of the same view, consecutively.

T

Tracy L

I am using MSP 2003. I have created a new view based on a new table that I
created and then have further created filteres by specific contents of an
added custom field. The contents of that field represents employee initials.
So be changing the filtered contents label I can switch between different
tasks associated to different employees all within the same GANNT view of the
same projects which are all in one MS project file.

I am thinking that the best way to print multiple filters of the same view
consecutively is too create a Macro that records me selecting and printing
the diferent filters. This appears to work however it stops at every print
dialog box asking me to press OK. I will need to print about 30 different
views twice a week and was hoping to automate this. I have not yet set up
resources yet and don't know if I should be using that part of MS Project to
acheive this as this is part of a Production Scheduling Report and requires
the use of the task with a GANNT view.

Can you help with disenabling the print dialog box or should I do this
completly different?

Thanks for any input.
 
J

John

Tracy L said:
I am using MSP 2003. I have created a new view based on a new table that I
created and then have further created filteres by specific contents of an
added custom field. The contents of that field represents employee initials.
So be changing the filtered contents label I can switch between different
tasks associated to different employees all within the same GANNT view of the
same projects which are all in one MS project file.

I am thinking that the best way to print multiple filters of the same view
consecutively is too create a Macro that records me selecting and printing
the diferent filters. This appears to work however it stops at every print
dialog box asking me to press OK. I will need to print about 30 different
views twice a week and was hoping to automate this. I have not yet set up
resources yet and don't know if I should be using that part of MS Project to
acheive this as this is part of a Production Scheduling Report and requires
the use of the task with a GANNT view.

Can you help with disenabling the print dialog box or should I do this
completly different?

Thanks for any input.

Tracy,
For your reference, once you actually set up resources in the Resource
Sheet, you will note that there is a field called Initials. Depending on
how the resource names are entered, this field will probably make your
custom field unnecessary.

If you didn't need the Gantt bars I might suggest you try the Resource
Usage view since it groups by resource. Nonetheless, if you want to
cycle through each resource for a filtered printout, VBA is probably the
best way to go. Recording a macro as you did is certainly a way to get
the basic code but it could be automated even further to cycle through
each resource without out any further input from the use. If that's what
you want, we could help you set that up.

With regard to the dialogue box, eliminating that is fairly easy but
there is a little trick to it. When a macro is recorded, the recorder
inserts the "FilePrint" Method (i.e. line of code). By itself, this line
will bring up the print dialogue box. The trick is to give the method an
argument even though all arguments are optional. The easiest way to
suppress the dialogue box is to use the following:
FilePrint FromPage:=1

Hope this helps.
John
Project MVP
 
T

Tracy L

John,
Thanks for the great response to my problem, however while the code of,
"FilePrint FromPage:=1" did eleiminate the print dialog box, it also
eliminated the print from and to dates for the GANNT chart and because I have
the project Finish date set at 2010, it printed several pages of GANNT chart
to that date. Any ideas on a code that would maintain a 3 month period from
the current date??

Thanks for your help
 
J

John

Tracy L said:
John,
Thanks for the great response to my problem, however while the code of,
"FilePrint FromPage:=1" did eleiminate the print dialog box, it also
eliminated the print from and to dates for the GANNT chart and because I have
the project Finish date set at 2010, it printed several pages of GANNT chart
to that date. Any ideas on a code that would maintain a 3 month period from
the current date??

Thanks for your help

Tracy,
Well....OK...you didn't mention that you also wanted a limited date
range on the printout. Nonetheless, that is a simple addition to the
FileSave Method but rather than have me spell out the details, (lest you
have other pint setup requirements), do the following.
1. Go to Tools/Macro/Macros and select your macro.
2. Hit Edit This will bring up the VB editor with your code in the
window.
3. Hit F2 or View/Object Browser
4. In the first selection box select "MSProject" as the Project/Library
5. In the "Search text" selection box type "FilePrint" and hit return
6. The FilePrint member will be highlighted. Hit the little icon with
the question mark
7. You will get the VBA help topic for the FilePrint Method. It will
explain all the available options. Set the options you want in the same
format as I showed in my original response (i.e. each option separated
by a comma and with a ":=")

Again, all this could be further automated in code that requires no
input from the user.

John
Project MVP
 
T

Tracy L

John,
Yes I am a novice at VBA outside of a macro scheme. This worked great.
Thanks for your help. And could you forward an email on hoe to contact you
for future consultation?

TracyL
 
J

John

Tracy L said:
John,
Yes I am a novice at VBA outside of a macro scheme. This worked great.
Thanks for your help. And could you forward an email on hoe to contact you
for future consultation?

TracyL

TracyL,
First of all, you're welcome. The best way to contact any of us is by
posting questions/issues to this newsgroup. If more direct or personal
help is warranted, or if you want to engage my services, so indicate and
I will be happy to provide further information.

John
Project MVP
 
T

Tracy L

John,
Well I have just one more problem with my little VBA script that I wrote
with your assistance.

FilterApply Name:="RS Projects"
FilePrint FromPage:=1, ToDate:="08/01/2006"

I set up the filter for the employee which I then choose, however I would
like the File Print to print from the first of the current month plus 2
months forward. It currently will print to :="08/01/2006" which is date set
manually. Can you provide me with the script to do that???

Thanks so much

TL
 
J

John

Tracy L said:
John,
Well I have just one more problem with my little VBA script that I wrote
with your assistance.

FilterApply Name:="RS Projects"
FilePrint FromPage:=1, ToDate:="08/01/2006"

I set up the filter for the employee which I then choose, however I would
like the File Print to print from the first of the current month plus 2
months forward. It currently will print to :="08/01/2006" which is date set
manually. Can you provide me with the script to do that???

Thanks so much

TL

Tracy,
The following code should do what you want, however it will, (for
today's date), print from 5/1/06 through 6/30/06, not to 8/1/06 as your
post says (because that would be 3 months plus a day). If that is not
your desire, adjust the value in the DateAdd Method as noted.

Sub Print_range()
CurDat = ActiveProject.CurrentDate
CurMon = Month(CurDat)
Strt = CStr(CurMon) & "/1/06"
TwoMon = DateAdd("m", 1, Strt) 'change index to change lookahead range
NoDays =
ActiveProject.Calendar.Years(Year(CurDat)).Months(Month(TwoMon)).Days.Cou
nt
Fin = DateAdd("d", NoDays, ThreeMon) - 1
FilePrint fromdate:=Strt, todate:=Fin
End Sub

Hope this helps.
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