TimeScaleData


D

David Chazin

Hi,

Am trying to create a weekly report, listing the Tasks on which a particular
Resource worked, with the hours worked each day in the week on each task,
that looks something like this:

Resource: John Smith
Task ID Task Name Sun Mon Tue Wed Thu Fri Sat
21 Coding 0 1 6 0 0 0 0
24 Testing 0 8 3 1 0 0
0

I'm using Project 2003, and can't seem to relate the TimeScaleValues with
their corresponding
Resource and Task at the same time.

The following code gives the TimeScaleValues for a particular RESOURCE for
the desired week:

Set tsvs = r.TimeScaleData(#6/15/2008#, #6/21/2008#, _
pjResourceTimescaledActualWork, pjTimescaleDays, 1)
For Each tsv in tsvs
[in here I need to be able to do something like:
Debug.Print tsv.Task.ID
except there does not seem to be a property of tsv that represents
the Task associated with the TimeScaleValue]
Next tsv

Similarly, the following code gives the TimeScaleValues for a particular
TASK for the desired week:

Set tsvs = t.TimeScaleData(#6/15/2008#, #6/21/2008#, _
pjTaskTimescaledActualWork, pjTimescaleDays, 1)
For Each tsv in tsvs
[in here I need to be able to do something like:
Debug.Print tsv.Resource.Name
except there does not seem to be a property of tsv that represents
the Resource associated with the TimeScaleValue]
Next tsv

Any ideas?

I posted this message in the microsoft.public.project.vba forum, and then
realized that this is the correct forum. Sorry for the double post.

Thanks in advance,
--David Chazin
 
Ad

Advertisements

J

Jack Dahlgren

I think you should be working with pjAssignmentTimescaledData type.

loop something like this:

for each resource in activeproject.resources
for each assignment in resource.assignments
'get and print assignment.taskname
'get assignment timescaledvalues
'iterate through values and write them out
next assignment
next resource


-Jack Dahlgren
 
Ad

Advertisements

D

David Chazin

Hi Jack,

That did the trick. Here is an excerpt from the code, that now works:

xlR = 2
For Each a In ActiveProject.Resources(RESOURCE_NAME).Assignments
bWasPrinted = False
Set tsvs = a.TimeScaleData(BEG_DATE, END_DATE, _
pjAssignmentTimescaledActualWork, pjTimescaleDays, 1)
For Each tsv In tsvs
If tsv.Value <> "" Then
xlC = tsv.StartDate - BEG_DATE + 4
xlSheet.Cells(xlR, xlC) = tsv.Value / 60
bWasPrinted = True
End If
Next tsv
If bWasPrinted Then
xlSheet.Cells(xlR, 1) = a.TaskID
xlSheet.Cells(xlR, 2) = a.TaskUniqueID
xlSheet.Cells(xlR, 3) = a.TaskName
xlSheet.Cells(xlR, 11) = "=SUM(D" & xlR & ":J" & xlR & ")"
xlR = xlR + 1
End If
Next a

Thanks a lot for your help.

--David Chazin


Jack Dahlgren said:
I think you should be working with pjAssignmentTimescaledData type.

loop something like this:

for each resource in activeproject.resources
for each assignment in resource.assignments
'get and print assignment.taskname
'get assignment timescaledvalues
'iterate through values and write them out
next assignment
next resource


-Jack Dahlgren

David Chazin said:
Hi,

Am trying to create a weekly report, listing the Tasks on which a
particular
Resource worked, with the hours worked each day in the week on each task,
that looks something like this:

Resource: John Smith
Task ID Task Name Sun Mon Tue Wed Thu Fri Sat
21 Coding 0 1 6 0 0 0
0
24 Testing 0 8 3 1 0 0
0

I'm using Project 2003, and can't seem to relate the TimeScaleValues with
their corresponding
Resource and Task at the same time.

The following code gives the TimeScaleValues for a particular RESOURCE
for
the desired week:

Set tsvs = r.TimeScaleData(#6/15/2008#, #6/21/2008#, _
pjResourceTimescaledActualWork, pjTimescaleDays, 1)
For Each tsv in tsvs
[in here I need to be able to do something like:
Debug.Print tsv.Task.ID
except there does not seem to be a property of tsv that represents
the Task associated with the TimeScaleValue]
Next tsv

Similarly, the following code gives the TimeScaleValues for a particular
TASK for the desired week:

Set tsvs = t.TimeScaleData(#6/15/2008#, #6/21/2008#, _
pjTaskTimescaledActualWork, pjTimescaleDays, 1)
For Each tsv in tsvs
[in here I need to be able to do something like:
Debug.Print tsv.Resource.Name
except there does not seem to be a property of tsv that represents
the Resource associated with the TimeScaleValue]
Next tsv

Any ideas?

I posted this message in the microsoft.public.project.vba forum, and then
realized that this is the correct forum. Sorry for the double post.

Thanks in advance,
--David Chazin
 

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