Timescale Data problem

S

sdf

I am using the code listed belwo to bring back Timescaled data into excel. I
did a little sanity chack the other day and noticed that it always returns
the heading for the first month, but does do bring data back for that month
even though data exists in project.

Could someone tell me if I'm missing soemthing, bad variable name or counter
.. . . .etc. cause I can't see it.

Jeff

For Each Tsv In ActiveProject.ProjectSummaryTask.TimeScaleData( _
StartDate:=ActiveProject.ProjectStart, _
EndDate:=ActiveProject.ProjectFinish, _
Type:=pjAssignmentTimescaledWork, _
timescaleunit:=pjTimescaleMonths, _
Count:=1)
xlRng = Tsv.StartDate
Set xlRng = xlRng.Offset(0, 1)
colctr = colctr + 1
Next

Set xlRng = xlRng.Offset(1, -colctr)

'Print Resource Group
For Each Group In ActiveProject.ResourceGroup
xlRng = Project.Group.Name
Set xlRng = xlRng.Offset(0, 1)
'Print Resource; Name
For Each res In Proj.Resources
If Not (res Is Nothing) Then
xlRng = res.Name
Set xlRng = xlRng.Offset(0, 1)
'Print assignments
For Each tsk In ActiveProject.Tasks
If Not (tsk Is Nothing) Then
For Each asn In tsk.Assignments
If res.Name = asn.ResourceName Then
xlRng = tsk.Name
Set xlRng = xlRng.Offset(0, 1)
colctr = 1
For Each Tsv In
asn.TimeScaleData(StartDate:=ActiveProject.ProjectStart,
EndDate:=ActiveProject.ProjectFinish, _

Type:=pjAssignmentTimescaledWork, timescaleunit:=pjTimescaleMonths, Count:=1)
xlRng = Val(Tsv.Value) / 60 / 7
Set xlRng = xlRng.Offset(0, 1)
colctr = colctr + 1
Next
Set xlRng = xlRng.Offset(1, -colctr)
End If
Next
End If
Next
End If
Set xlRng = xlRng.Offset(0, -1)
Next
Set xlRng = xlRng.Offset(0, -1)
Next
 
R

Rod Gill

Hi,

Haven't looked in detail, but in the first For Next loop you don't use the
colctr variable, just increment it. I don't know what layout you want in
Excel, but you need to offset your Excel range for each time slice: The For
Next loop happens once for each time slice.
 
J

Jan De Messemaeker

Hi,

There are also a few puzzling instructions in Project, but they may be due
to typos:

For Each Group In ActiveProject.ResourceGroup
' I suppose you mean ResourceGroups
'I would call that variable AnyGroup or so, better never use a name used by
VBA to name a variable

xlRng = Project.Group.Name
'Now this beats me. If you mean the Group object you just got then this
should read
xlrng=Group.name

And what is Project here? never defined. If it is a project, it will not
have the group property.
I cannot believe this even works or returns anything

And finally... why bother about group names? They do not sem to be used in
the remaining logic.

Three lines below suddenly appears an object called proj... don't know what
that stands for either

Hope this helps,
 
J

Jeff

JAn thanks for the direction,

I declared Project as "Dim Proj As Project". SHould I have declared it as
something different?

As for the reference to "ActiveProject.ResourceGroup", if I change it to . .
.Groups I get back my enterprise resource pool labelled under "&No Group",
then the same resources listed under "Complete and &Incomplete Resources" and
then under "Resource &Group" and so on. So I use the ...group option to limit
the retunr of data.

By changing the "Project.Group.Name" reference to simply "Group.Name"
brought in the missing month opf data I was looking for. Thnaks.


As for Group Names, I must include them as it is mandataed for reporting by
my firm.

Thanks for the help
 
J

Jan De Messemaeker

Hi,

Are your reporting needing people aware of the fact that .ResourceGroups
give you the criteria by which you CAN group resources, which has nothiong
to do with what is in th Group field of the resources?
I still fail to see any iuse in listing these ResourceGroups' Names. They
are not groups of resources!
HTH
 
J

Jeff

IN all honesty I think its simply so that they don't have to do anything
special when they combine and summerize.

THanks for your help though my reprot at least fits my needs and those of
the boys downtown.

Jeff
 

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