M
MartyO
We have Project Prof. 2003
I have a VBA background in MS Access, new at VB in MS Project.
I started with Jack Dahlgren's "Print Resource Charts" code on his website
(prints Gantt's for all the resources) 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. My custom report for now is a To Do List with particular fields
and prints "using resources".
I can't find any example code to do this in Project, so this is my shot in
the dark starting with some of Jack's code.
Private Sub UserForm_Initialize()
'this works fine, the ListBox1 has all of these names when the form opens
ListBox1.ColumnCount = 1
ListBox1.AddItem "Alison K."
ListBox1.AddItem "Bryon H."
ListBox1.AddItem "Chris B."
ListBox1.AddItem "Deborah D."
End Sub
Private Sub ToDoLists_Click()
Dim mystring As String
Dim lst As ListBox
(I want to loop through ListBox1 on the form, grab a Resource name and pass
it to the custom To Do List Report, and print each individual's To Do List. )
Set lst = Me.ListBox1 (this doesn't work, lst init's with "")
For Each varItem In lst
mystring = lst.Value (starting here is Jack's code sort of)
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
Thanks in advance for your help!
Marty
I have a VBA background in MS Access, new at VB in MS Project.
I started with Jack Dahlgren's "Print Resource Charts" code on his website
(prints Gantt's for all the resources) 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. My custom report for now is a To Do List with particular fields
and prints "using resources".
I can't find any example code to do this in Project, so this is my shot in
the dark starting with some of Jack's code.
Private Sub UserForm_Initialize()
'this works fine, the ListBox1 has all of these names when the form opens
ListBox1.ColumnCount = 1
ListBox1.AddItem "Alison K."
ListBox1.AddItem "Bryon H."
ListBox1.AddItem "Chris B."
ListBox1.AddItem "Deborah D."
End Sub
Private Sub ToDoLists_Click()
Dim mystring As String
Dim lst As ListBox
(I want to loop through ListBox1 on the form, grab a Resource name and pass
it to the custom To Do List Report, and print each individual's To Do List. )
Set lst = Me.ListBox1 (this doesn't work, lst init's with "")
For Each varItem In lst
mystring = lst.Value (starting here is Jack's code sort of)
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
Thanks in advance for your help!
Marty