On Wed, 11 Jan 2006 00:12:28 +0800,  "Stefan Elwesthal"
<[EMAIL PROTECTED]> wrote:

>
> I have to ask, cause two days later I'm starting to get annoyed  ;-)
>
> How could I use PythonCOM and save my re-worked Excel file as an xlCSV
> file? All I get is
> "SaveAs method in Worksheet class failed".
>
> Is something wrong with this line?
> sh.SaveAs("C:\file.csv", FileFormat='xlCSV')
>

Besides the xlCSV constant issue, there is another problem.  "\f" is not
two characters -- it is one character, the ASCII formfeed.  You either
need to escape it or use the other slash:

    sh.SaveAs( "c:/file.csv", FileFormat=win32com.constants.xlCSV )
or
    sh.SaveAs( "c:\\file.csv", FileFormat=win32com.constants.xlCSV )
or
    sh.SaveAs( r"c:\file.csv", FileFormat=win32com.constants.xlCSV )

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to