VBA Code to display Resource Graphs for Specific Resources

P

Peter Rooney

Could some kind soul give me a clue as to how to display the resource graph
for a specific Resource using VBA.
I want to be able to run a macro that displays the graph for Resource A,
prints it, Resource B, prints it, and do on.
When I roll my mouse down on the chart view, the recorder records
"SelectCellRight", but this is not a solution, as I might want to print
graphss for non-contiguous Resources.

Thanks in advance

Pete
 
J

Jan De Messemaeker

Hi Peter,

I'm not 100%sure how you want to run this but the following macro should
give you a start:

Sub PrintResoGr()
Dim Ctr As Integer
Dim RN As String
Dim Res As Resource
ViewApply "Resource Graph"
Begin:
SelectBeginning
RN = InputBox("Give Resource Name")
If Len(RN) = 0 Then Exit Sub
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
If LCase(Res.Name) = LCase(RN) Then FilePrintPreview
End If
SelectCellRight
Next Res
GoTo Begin
End Sub

Tested in P2000.
HTH
 
P

Peter Rooney

Jan,

Sorry for not getting back to you yesterday.
This is a good start for me, but if I don't want to scroll through all the
Graphs and instead only want to print out a certain set of graphs, say, for a
subset of my resources, is there any way in which I can say (for example):

<<Display the Graph for Laura Jones>>
FilePrint FromDate:="31/01/05 09:00", Todate:="27/02/05 17:30"

<<Display the Graph for Graham Tatton>>
FilePrint FromDate:="31/01/05 09:00", Todate:="27/02/05 17:30"

<<Display the Graph for Peter Eardley>>
FilePrint FromDate:="31/01/05 09:00", Todate:="27/02/05 17:30"

etc etc

Thanks

Pete
 
J

Jan De Messemaeker

Hi Peter,
That's exactly what I want my code to help you with!
You only have to add the print instruction, the selection mechanism is
there.
Try it!
HTH
 
P

Peter Rooney

Jan,
You're right - I had to think a little - THAT was the problem
The printer is merrily spewing out graphs, now, much to the disgust of the
conservationists in the office!

Thanks again

Pete

P.S. What dows "HTH" stand for?
 

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