[python-win32] MSProject and export maps

Tim Golden mail at timgolden.me.uk
Fri May 23 10:44:37 CEST 2008


Roger Upole wrote:
> Ron Henderson wrote:
>> My guess is that it *is* a Python problem somewhere in the win32com 
>> bindings, based on the fact that executing a macro seems to do the 
>> right thing but going directly through the com API from Python does not.
>>
>> The macro executes essentially the same functionality:
>>
>> Sub my_export()
>>     FileSaveAs name:="...", formatId:="MSProject.CSV", map:="My Map"
>> End Sub
>>
> 
> Have you tried using exactly the same parameters in your Python code?
> It's using Format=3 instead of FormatId.
> 
> If that doesn't get it, it may have something to do with the default
> values for arguments that you're not passing.

This works for me (I basically recorded a Macro and reproduced it):

<code>
import win32com.client

project = win32com.client.Dispatch ("MSProject.Application")
project.FileOpen ("c:/temp/p1.mpp")
project.FileSaveAs (Name="c:/temp/p2.csv", FormatID="MSProject.CSV", Map="p1")
project.FileClose (Save=0)
project.FileQuit ()

</code>

TJG


More information about the python-win32 mailing list