Skip to content
Advertisement

Converting Excel to PDF with pywin32 [Error]

I try to export one of my xlsx files as PDF with pywin32:

JavaScript

Unfortunately I get this com_error:

JavaScript

In the end I want to do use this conversion on 30 xlsx files at once. I know how to write the loop for this but can not fix the above mentioned error.

Advertisement

Answer

When using Python paths on Windows, you need to use \ not /. So convert all your paths to use the double backslash instead of the forward slash:

JavaScript

Your ExportAsFixedFormat function call looks fine so I don’t see any other problem.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement