Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

resource assignment

$
0
0

Hello,

I am programming for MSProject 2003 application and I am meeting a problem...

For a task i, I check if the resource called "DG3" is assigned or not. For information, this resource is a material resource and the unit is a quantity called "UnitesAffectation".

If "DG3" is not assigned, i want to create the assignment in the Task_i with the "UnitesAffectation" unit.

When I launch the code, I have the running error '1101 --> Assignement problem". Thank's a lot for your answers

---------------------------------------------------------------------------------------------------------------------------

The code I created is the following:

Public Sub Ajustement_Affectation()

Set Task_i = ActiveProject.Tasks(i)
  
    For Each Affectation In Task_i.Assignments
        TypeAffectation = Affectation.ResourceType
        NomRessAffectee = Affectation.ResourceName
        UnitesAffectation = Affectation.Units
          
        If Not NomRessAffectee = "DG3" Then
            Set RessourceAffectee = ActiveProject.Resources("DG3")
            Set Affectation = Task_i.Assignments.Add(Task_i.ID, ResourceID:=RessourceAffectee.ID)
            UnitesAffectation = NbIndemJrNORMALTotal
        Else
            UnitesAffectation= NbIndemJrNORMALTotal
        End If

    ... (the same code with other resources DGx)

    Next Affectation
End Sub


Viewing all articles
Browse latest Browse all 5347

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>