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