comtypes
comtypes copied to clipboard
Problem saving PowerPoint files as PDFs
Hi
I have a similar issue to this one (comtypes 1.1.7):
https://github.com/enthought/comtypes/issues/129
My code snippet is
import comtypes.client
ppFormatPDF = 32
for fname in ["test1", "test2"]:
in_file = fname + ".pptx"
out_file = fname + ".pdf"
app = comtypes.client.CreateObject('Powerpoint.Application')
ppt = app.Presentations.Open(in_file)
ppt.SaveAs(out_file, FileFormat=ppFormatPDF)
ppt.Close()
app.Quit()
This seems to work OK saving test1.pptx as a PDF but trying to save the next one results in this error:
ppt.SaveAs(out_file, FileFormat=ppFormatPDF) _ctypes.COMError: (-2147188720, None, ('Presentation (unknown member) : Object does not exist.', 'Microsoft PowerPoint', '', 0, None))
Would appreciate any thoughts you may have - thanks!
Seeing the exact same issue.
Looks like language independent problem with PowerPoint COM interface usage. Guys could solve similar one (the same error code) with VBScript: https://stackoverflow.com/q/54508873/3648361