J
Juan
Hi again,
I use the TimeScaleData in an Excelsheet in order to import some values from
MS Project.
I've been trying to think of the iteration that may let me import these
values half-monthly, but since im a relative beginner with VBA, this is
turning to be a little bit too difficult for me.
Since i want to get "work" and "cost" for the periods 1st to 15th and 16th
to end of the month, im doing using "day" as unit for the timescaled import.
But regarding to the loop that should allow me to add the daily values
according to my periods Ive made no progress.
I would be very grateful if someone could help me with this.
Im posting the code im using.
....
viewapply (mApp.ActiveProject.ViewList(3))
Set xlcell = Range("A2")
For r = 1 To mApp.ActiveProject.Resources.Count
If Not mApp.ActiveProject.Resources.Item(r) Is Nothing Then
If mApp.ActiveProject.Resources.Item(r).Type = 0 Then
' pjResourceTypeWork
xlcell.Value =
mApp.ActiveProject.Resources.Item(r).Name
Set xlcell = xlcell.Offset(1, 0) 'step down 1 row
ElseIf mApp.ActiveProject.Resources.Item(r).Type = 1 Then
xlcell.Value =
mApp.ActiveProject.Resources.Item(r).Name
Set xlcell = xlcell.Offset(1, 0)
End If
End If
Next
sdatum = ActiveSheet.Range("B24").Value
edatum = ActiveSheet.Range("B25").Value
AnzInt = DateDiff("m", sdatum, edatum) + 1
'ActiveSheet.Range("RangeRessourcen").Select
'Set RR = ActiveSheet.Range("RangeRessourcen")
'RR.Select
For Each c In ActiveSheet.Range("RangeRessourcen")
ResName = Cells(c.Row, 2).Value
If ResName <> "" Then
For r = 1 To mApp.ActiveProject.Resources.Count
If Not mApp.ActiveProject.Resources.Item(r) Is
Nothing Then
If mApp.ActiveProject.Resources.Item(r).Name =
ResName Then
Application.Caption = "Datensatz" & r
Application.Cells(c.Row, 2).Value =
(mApp.ActiveProject.Resources(r).Cost) * 1
Application.Cells(c.Row, 3).Value =
(mApp.ActiveProject.Resources(r).Work / 60) * 1
For x = 1 To AnzInt
Set tsv =
mApp.ActiveProject.Resources(r).TimeScaleData(sdatum, edatum, Type:=13,
TimescaleUnit:=4)
strValue = Val(tsv(x).Value) / 60
ITERATION...
Next x
End If
End If
Next r
Set tsv = Nothing
End If
Next
I use the TimeScaleData in an Excelsheet in order to import some values from
MS Project.
I've been trying to think of the iteration that may let me import these
values half-monthly, but since im a relative beginner with VBA, this is
turning to be a little bit too difficult for me.
Since i want to get "work" and "cost" for the periods 1st to 15th and 16th
to end of the month, im doing using "day" as unit for the timescaled import.
But regarding to the loop that should allow me to add the daily values
according to my periods Ive made no progress.
I would be very grateful if someone could help me with this.
Im posting the code im using.
....
viewapply (mApp.ActiveProject.ViewList(3))
Set xlcell = Range("A2")
For r = 1 To mApp.ActiveProject.Resources.Count
If Not mApp.ActiveProject.Resources.Item(r) Is Nothing Then
If mApp.ActiveProject.Resources.Item(r).Type = 0 Then
' pjResourceTypeWork
xlcell.Value =
mApp.ActiveProject.Resources.Item(r).Name
Set xlcell = xlcell.Offset(1, 0) 'step down 1 row
ElseIf mApp.ActiveProject.Resources.Item(r).Type = 1 Then
xlcell.Value =
mApp.ActiveProject.Resources.Item(r).Name
Set xlcell = xlcell.Offset(1, 0)
End If
End If
Next
sdatum = ActiveSheet.Range("B24").Value
edatum = ActiveSheet.Range("B25").Value
AnzInt = DateDiff("m", sdatum, edatum) + 1
'ActiveSheet.Range("RangeRessourcen").Select
'Set RR = ActiveSheet.Range("RangeRessourcen")
'RR.Select
For Each c In ActiveSheet.Range("RangeRessourcen")
ResName = Cells(c.Row, 2).Value
If ResName <> "" Then
For r = 1 To mApp.ActiveProject.Resources.Count
If Not mApp.ActiveProject.Resources.Item(r) Is
Nothing Then
If mApp.ActiveProject.Resources.Item(r).Name =
ResName Then
Application.Caption = "Datensatz" & r
Application.Cells(c.Row, 2).Value =
(mApp.ActiveProject.Resources(r).Cost) * 1
Application.Cells(c.Row, 3).Value =
(mApp.ActiveProject.Resources(r).Work / 60) * 1
For x = 1 To AnzInt
Set tsv =
mApp.ActiveProject.Resources(r).TimeScaleData(sdatum, edatum, Type:=13,
TimescaleUnit:=4)
strValue = Val(tsv(x).Value) / 60
ITERATION...
Next x
End If
End If
Next r
Set tsv = Nothing
End If
Next