Script Collection
Microsoft Office
Automating Microsoft Powerpoint | Automating Microsoft Powerpoint |
|
|
|
|
One more example how to automate Microsoft Powerpoint and printout a
postscript file with a specified postscript printer (yes, more than one
printers can be installed on the system).
Multithreadding: Unlike Word and Excel Powerpoint can not run in multiple instances.
If you want to use Powerpoint server based you must implement code to
handle the Powerpoint processes. How to call the function: You simply call the function with the name of the Word file, Postscript file and the printername which you want to use.: e.g.:
The source code: def powerpoint(powerpointfile, psfile, printer): pythoncom.CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED) myPowerpoint = win32com.client.DispatchEx('Powerpoint.Application') myPpt = myPowerpoint.Presentations.Open(powerpointfile, False, False, False) myPpt.PrintOptions.PrintInBackground = 0 myPpt.PrintOptions.ActivePrinter = printer myPpt.Saved = 1 myPpt.PrintOut(1, 5000, psfile, 0, False) myPpt.Close() #myPowerpoint.Quit() del myPpt #del myPowerpoint pythoncom.CoUninitialize() |
|
| Last Updated ( Thursday, 02 February 2006 ) |
| < Prev | Next > |
|---|
Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.