I am working on a huge set of macros to read workload data from MSP files and Excel files to update a master planning and a resource pool (both MSP).
My Excel files all have same template and list tasks, start dates, end dates and allocated resources and look like this
The task is created by the macro, with Start Date and End Date. This part works fine. Even Outline level works fine.
Macro reads data in Excel's column 12 to get resource names (stored in an array) and cross checks name with names listed in resource pool (stored in a second array ResPoolArr along with corresponding ID).
My issue is that Ta.Assignments.Add ResourceID:=ResPoolArr(RowResPoolArr, 1), Units:=1
returns a 'The resource does not exist' error while I get an effective ID (e.g. ResPoolArr(RowResPoolArr, 1) = 50)
I also tried another way round by using Ta.Resources.Add() but it didn't work either.
Ta.Assignments.Add Ta.id, ResPoolArr(RowResPoolArr, 1)
works and solved my issue