S
stuart block
I am truely stuck on the following piece of code.
This is the code that I have developed but it stops when I try and get the
work figure. Any ideas....
Sub Export1()
Dim t As Resource
Dim stat As Date
Dim xlRow As Excel.Range
Dim wrk As Long
Dim wrk1 as Long
Set xlApp = New Excel.Application
xlApp.Visible = True
AppActivate "Microsoft Excel"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Name = "Test"
Set xlRow = xlApp.ActiveCell
stat = ActiveProject.ProjectStart
With ActiveProject
numweeks = (.ProjectFinish - .ProjectStart) \ 7 + 1
End With
For I = 0 To numweeks
For Each t In ActiveProject.Resources
' IT STOPS HERE ***************
Set wrk = t.TimeScaleData(stat, (stat + 7), timscaleunit =
pjTimescaleWeeks).Value
If wrk = "" then
wrk1 = 0
else
wrk1 = wrk / 60
xlRow.Value = t.Project
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = stat
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = t.Name
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = wrk
Set xlRow = xlRow.Offset(1, -3)
Next t
stat = stat + 7
Next I
End Sub
Thanks
Stuart
This is the code that I have developed but it stops when I try and get the
work figure. Any ideas....
Sub Export1()
Dim t As Resource
Dim stat As Date
Dim xlRow As Excel.Range
Dim wrk As Long
Dim wrk1 as Long
Set xlApp = New Excel.Application
xlApp.Visible = True
AppActivate "Microsoft Excel"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Name = "Test"
Set xlRow = xlApp.ActiveCell
stat = ActiveProject.ProjectStart
With ActiveProject
numweeks = (.ProjectFinish - .ProjectStart) \ 7 + 1
End With
For I = 0 To numweeks
For Each t In ActiveProject.Resources
' IT STOPS HERE ***************
Set wrk = t.TimeScaleData(stat, (stat + 7), timscaleunit =
pjTimescaleWeeks).Value
If wrk = "" then
wrk1 = 0
else
wrk1 = wrk / 60
xlRow.Value = t.Project
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = stat
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = t.Name
Set xlRow = xlRow.Offset(0, 1)
xlRow.Value = wrk
Set xlRow = xlRow.Offset(1, -3)
Next t
stat = stat + 7
Next I
End Sub
Thanks
Stuart