How to 'refresh' resource data at plan with enterprise resource data with vba?

Domanda How to 'refresh' resource data at plan with enterprise resource data with vba?

  • martedì 12 giugno 2012 08:10
     
     

    Hi,

    I use the following function to get ResourceTimescaledUnitAvailability for a given Resource, TimephasedType, TimescaleUnit and date.

    When the % Availability of the enterprise resource is changed on the server, the function receives still the previous value until I close the plan and reopen it.

    Is it possible to "refresh" the resources values with the enterprise values without reopen the plan?
    I did not found any project method for that.

    Thanks,
    Stefan


    Function getResourceTimescaleUnit(r As Resource, TimephasedType As Long, TimescaleUnit As PjTimescaleUnit, pdate As Date) As Double
        ' Get TimescaleUnit für Resource/TimephasedType/Date
       
        ' Sample:
        ' ? getResourceTimescaleUnit(activeproject.resources("Project Server, TEAM-MEMBER"), pjResourceTimescaledUnitAvailability, pjTimescaleMonths, "01.09.2012") * 100
       
        Dim tmp_var As Variant
        Dim tmp_dbl As Double
        Dim TSV As TimeScaleValues
        Dim TSVi As Long
       
        Set TSV = r.TimeScaleData(pdate, pdate, Type:=TimephasedType, TimescaleUnit:=TimescaleUnit)
       
        tmp_dbl = 0
        If Not TSV Is Nothing Then
            For TSVi = 1 To TSV.Count
                tmp_var = TSV(TSVi).Value
                If IsNumeric(tmp_var) Then
                    tmp_dbl = tmp_dbl + tmp_var
                End If
            Next TSVi
        End If
       
        getResourceTimescaleUnit = tmp_dbl
    End Function