Print Custom Report w/ certain Resources

M

MartyO

Project 2003
I have a background in writing code in Access.
I started with Jack Dahlgren's "Print Resource Charts" code on his website
but need to take it a step further and only print certain resources with
certain custom reports.
Here's what I have so far...
1. Userform that when opened initializes ListBox1 with the Resource names
that I want to use. That works fine
2. A button on the form, when clicked, fires off code that should loop
through the ListBox1 values and print the custom report for each resource in
the list.
I can't find any example code to do this in Project, so this is my shot in
the dark.
Private Sub ToDoLists_Click()
Dim mystring As String
Dim lst As ListBox

Set lst = Me.ListBox1
For Each varItem In lst
mystring = lst.Value
FilterEdit Name:="Filter 1", TaskFilter:=True, Create:=True, _
OverwriteExisting:=True, FieldName:="Resource Names", test:="Contains
exactly", _
Value:=mystring, ShowInMenu:=False, ShowSummaryTasks:=False
FilterApply "Filter 1"
FilePageSetupHeader Text:="To Do List For: " & mystring
SelectAll
'ZoomTimescale Selection:=True
SendKeys "{ENTER}"
FilePrint
MsgBox (mystring)

ReportPrint Name:="To Do List - Custom"

Next varItem

End Sub

Private Sub UserForm_Initialize()
Dim r As Resource
For Each r In ActiveProject.Resources
cboResource.AddItem r.Name
Next r

ListBox1.ColumnCount = 1
ListBox1.AddItem "Alison K."
ListBox1.AddItem "Bryon H."
ListBox1.AddItem "Chris B."
ListBox1.AddItem "Chrysalis"
ListBox1.AddItem "Deborah D."


End Sub

Thanks!
Marty
 
M

Mike Glen

Hi Marty,

Try posting on the developer newsgroup. Please see FAQ Item: 24. Project
Newsgroups. FAQs, companion products and other useful Project information
can be seen at this web address: http://www.mvps.org/project/.

Mike Glen
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