[python-win32] MSProject and export maps

Tim Golden mail at timgolden.me.uk
Wed May 28 10:32:28 CEST 2008


Ron Henderson wrote:
> Thanks so much for trying this out.  You've verified that it's possible 
> to get this working.
> 
> However, when I execute the same code, the file "p2.csv" is exactly same 
> size as p1.mpp and contains binary data, not the text.  Since you have 
> it working it must be a bug in either my version of MSProject or 
> win32com.  I'm using:

(BTW Office Project Standard 2003 11.0.2003.0816.15)

Also, and please don't take this the wrong way, could you post
a screen dump of your interpreter window, showing the (equivalent)
code *and the output file*. I attach mine below. What I'm trying to
eliminate is one of those annoying typo-thinko errors we all make
where we pass the wrong filename or something and don't notice.

<dump>
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
>>>
>>> project = win32com.client.Dispatch ("MSProject.Application")
>>> project.FileOpen ("c:/temp/p1.mpp")
True
>>> FILENAME = "c:/temp/p2.csv"
>>> project.FileSaveAs (Name=FILENAME, FormatID="MSProject.CSV", Map="p1")
True
>>> project.FileClose (Save=0)
True
>>> project.FileQuit ()
True
>>> print open (FILENAME).read ()
Name,Actual_Cost
Do something,ú0.00

>>>

</dump>

Because I was reusing a filename, I had to press the [OK] to overwrite
somewhere in the FileSaveAs manoeuvre. Doubt it made a difference.

TJG



More information about the python-win32 mailing list