TimescaleData

M

meliskey

I am trying to get at the assignment data (in VBA), but every time I chage
this code to go against resource or assignment it gives me a generic error.
Any help would be apprechated.

Sub WorkHoursPerDay()
Dim TSV As TimeScaleValues, HowMany As Long
Dim HoursPerDay As String

Set TSV = ActiveCell.Task.timescaledata("8/1/06", "8/30/06",
pjTaskTimescaledBaseline10Work, TimescaleUnit:=pjTimescaleWeeks)

For HowMany = 1 To TSV.Count
If TSV(HowMany).Value = "" Then
HoursPerDay = HoursPerDay & TSV(HowMany).StartDate & " - " & _
TSV(HowMany).EndDate & ": 0 hours" & vbCrLf
Else
HoursPerDay = HoursPerDay & TSV(HowMany).StartDate & " - " & _
TSV(HowMany).EndDate & ": " & TSV(HowMany).Value / 60 & _
" hours" & vbCrLf
End If
Next HowMany

MsgBox HoursPerDay

End Sub
 
J

Jan De Messemaeker

Hi,

The activecell object has no property to identify the assignment.
In the task Usage view, the resource property can not be accessed and vice
versa.
AFAIK an assignment can onlybe accessed as assignments(index) where index is
the number or through
For each anAssmt in anytask.assignments , or
For each anAssmt in anyresource.assignments

HTH
 
M

meliskey

Ok, Different approach. I want to enter data into the baseline work 10 field
in the detail assignment view by week, I then want to be able to sum it up
and deposit that sum in baseline work 10 or a custom field in the resource
and task views. Basicallly the same function as recording actualls, but not
affecting the planned data.

Any ideas? I have a macro that handles the work at the task/assignment
level, but not yet at the assignment detail level.
 
J

Jan De Messemaeker

Hi,

It's not what you want to do that's the problem, but how to access
assignment objects, which cannot be done through the activecell directly.
I gave it some tests but I don't even find a way to identify which
assignment is selected

When in the task usage view you could use
Set job=activecell.task
and from there make your totals (regardless of which assignment you just
updated)

The alternative is to enter some data in a custom field (say flag5) when
updating and walk through the assignments:

For each assg in job.assignments
if assg.flag5="Yes" then

Hope this helps
 
M

meliskey

Is there another way to access the assignment objects (not using active cell)?

I have tried different things but I do not get data.
 
J

Jan De Messemaeker

Hi,
Say you have to locate an assignment from which you know the task name and
the resource name
Set job=activeproject.tasks(Taskname)
for each assg in job.assignments
if assg.resourcename= theresourcename then
exit for
end if
next

Hope this helps
 

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