How do I extract Time Scaled Data from MS Project into MS Excel

C

chuks79

I have been trying to use the Time Scaled Data method to extract hours
from MS Project into MS Excel and I have been running into loads of
problems.

I was able to put get the code for extracting data from Excel into MS
Project, but I cannot do it the other way. The code for extracting from
Excel to Project is:

For Each oAssignment In oResource.Assignments
If oAssignment.TaskID = oExcelRange Then
Set oTimeScale = oAssignment.TimeScaleData(oWeekStart, _
oWeekEnd + 1, pjAssignmentTimescaledActualWork,
pjTimescaleDays, 1)

For iDayCount = 1 To 7
oTimeScale.Add CStr(oExcelRange.Offset(0, 9 + iDayCount)),
iDayCount
Next
End If
Next 'Assignment

Please advise on how I can extract time scaled data from MS Project
into MS Excel.

Thanks.
Paul
 
J

Jan De Messemaeker

Hi,

With what you know, I fail to dsee the problem
Once you have your oTimeScale collection

For Counter=1 to oTimeScale.Count
DataforExcel=oTimeScale(Counter).value
..... write these data to the appropriate cell in Excel
next counter
Hope this helps
 
C

chuks79

Thanks alot. I'm actually an entirely new programmer using VB. I am
working with an already-exisitng code (which provides how to collect
timecaledata from Excel and put it in Project...I'm just at a loss how
to do the opposite. I'd appreciate your input.

Regards.
 
J

Jan De Messemaeker

Hi Chucks,

In VBE make sure you get the reference to Microsoft Project active.
Now look up the help for
TimeScaleData method
TimeScaleValues Collection Object
Using the Timescale data method you can define a TimeScale Values
collection.

Then, as I said in my previous note, once you have this collection,

Once you have your oTimeScale collection

For Counter=1 to oTimeScale.Count
DataforExcel=oTimeScale(Counter).value
..... write these data to the appropriate cell in Excel
next counter


Hope this helps,
 
R

Rod Gill

The other way to loop which I find simpler (1 less line of code and I'm a
lazy bugger) is:

Dim tsvs as Timescalevalues
Dim tsv as Timescalevalue

Set tsvs= Timescaled method

for each tsv in tsvs

next tsv
 

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