Using Resource.EnterpriseTeamMember(prj) RRS feed

  • Question

  • I am writing a VBA script for MS Project Pro 2010.  We are in an enterprise environment and the script sets the booking type of all resources to Proposed.

    Here is my code to accomplish that task:

    Private Sub SetResourceProp(prj As Project, items As Resources, setBookingCommit As Tristate)
        Dim r As Resource
        For Each r In items
            If r.EnterpriseTeamMember(prj) <> False Then
                If setBookingCommit = isTrue Then
                    r.BookingType = pjBookingTypeCommitted
                ElseIf setBookingCommit = isFalse Then
                    r.BookingType = pjBookingTypeProposed
                End If
            End If
        Next r
    End Sub

    For each resource, I use the EnterpriseTeamMember method to verify that the resource is part of the active project.  If I write the if statement as:

       If r.EnterpriseTeamMember(prj) = True Then

    It never enters the if statement.  However, if I write the if statement as:

       If r.EnterpriseTeamMember(prj) <> False Then

    It works as expected.  The EnterpriseTeamMember method returns a Boolean so these should logically be identical, but they are not.  Is there something I do not understand correctly?

    Tuesday, September 24, 2013 9:06 PM


  • Hi,

    It seems the issue isn’t related to “true” and “not false”, The EnterpriseTeamMember function is return a boolean value. I recommend you to check the prj and items parameters of SetResourceProp function,Or you can set a break point in if statement and add watch EnterpriseTeamMember function return.


    Friday, September 27, 2013 11:26 AM