Trouble with win32com and MS Project

Felix Collins felix at keyremovethisghost.com
Wed Oct 19 23:55:39 EDT 2005


Felix Collins wrote:
> Hi,
> 
> I'm trying to assign a resource to a task in MS Project by using the 
> example from MSDN for VB...
> 
> 
> "Use the Add method to add an Assignment object to the Assignments 
> collection. The following example adds a resource identified by the 
> number of 212 as a new assignment for the specified task.
> 
> ActiveProject.Tasks(1).Assignments.Add ResourceID:=212"
> 
> My code fragment for Python...
> 
> proj.Tasks(3).Assignments.Add(ResourceID=2)

I managed to get this to work by providing the TaskID which is supposed 
to be an optional argument.  I wonder if the win32com wrapper is 
stuffing this up.  Is late binding responsible perhaps?

So the code that works is...

proj.Tasks(3).Assignments.Add(TaskID= 3,ResourceID=2)

incidently this also works...

proj.Tasks(3).Assignments.Add(TaskID= 5,ResourceID=2)

which does seems a bit strange....



More information about the Python-list mailing list