473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Trouble with win32com and MS Project

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
2 2647
Hi !
The parameter (ResourceID=2) is problematic

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

@-salutations

Michel Claveau

Oct 20 '05 #2
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: R.Marquez | last post by:
I finally got around to start testing some of my old apps with Python 2.3. I've had no problems so far, but I did get one intriging warning. The following is from the Python Command Line: ...
1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
3
by: RJ | last post by:
Hi, I've been going over the Quick Start to Client side COM and Python and many other sources, but cannot find an example that will get my com/ActiveX .ocx USB device driver imported. The Excel...
2
by: Sibylle Koczian | last post by:
Hello, I've installed Python 2.4 and the win32 extensions, using administrator rights, under Windows XP in "C:\Programme". As this is a directory without spaces I didn't expect any problems. But...
0
by: Fozzie | last post by:
Hi, I have a problem which is quite circular, and hopefully either someone has encountered something similar or has a reason why this will not work. We have a COM library providing...
7
by: cfriedalek | last post by:
I'm interacting with a third party application using python and com. However having problems and don't know what to look at next to resolve the issue. The app. can be driven by VBS. The...
0
by: Greg Corradini | last post by:
Hello, Lately I've been using the mx.ODBC module to query Access (mdb) tables. For the life of me, I can't get the 'create table' sql command to work. I use this command in Oracle and I've seen...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
4
by: sterling | last post by:
I'm curious as to why the difference between IDLE and pythonWin when using win32com. opening an excel file, i've attempted to grab the chart information out of the file. commands like co =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.