By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

Trouble with win32com and MS Project

P: n/a
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)

but this doesn't work. I get...

Error (-2147352567, 'Exception occurred.', (0, None, 'The argument value
is not valid.', 'D:\\Program Files\\Microsoft
Office\\OFFICE11\\VBAPJ.CHM', 131074, -2146827187), None)
Anyone got any ideas about how to attack this?

Cheers,
Felix
Oct 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi !
The parameter (ResourceID=2) is problematic

Try :
proj.Tasks(3).Assignments.Add(2)

@-salutations

Michel Claveau

Oct 20 '05 #2

P: n/a
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....
Oct 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.