win32 com problem

John Machin sjmachin at lexicon.net
Tue Dec 5 06:34:49 EST 2006


Mike P wrote:
> Thanks for the quick reply,
>
> the code i am running is the following
>
> import win32com.client
> xl = win32com.client.Dispatch("Excel.Application")
> ppt = win32com.client.Dispatch("PowerPoint.Application")
> ppt.Visible = 1 #open MS Powerpoint
> xl.Visible = 1 #open MS Excel
> xl.Workbooks.Open('%s/working_output.xls' % (working_dir))
> xl.Workbooks.Open('Z:\\projects\\surveys\\SPSS - Generic
> files\\CTP.xla')

Does this file contain a sheet named "sheet1"? Maybe it should be
"Sheet1"; I can never remember what is case-sensitive and what's not
:-)

If so, does that sheet contain a macro called "CTP"?

> ppt.Presentations.Open('Z:\\projects\\surveys\\SPSS - Generic
> files\\Basic Template.ppt')
> xl.Application.Workbooks("working_output").Activate
> xl.Application.Run("CTP.xla!sheet1.CTP")

See above questions.

>
> I'm running via SPSS V15 which has a python plugin, i was previousky
> running in V14 using the exact same code with no problems?

Have you asked SPSS about the CTP.xla file (which I guess is supplied
by them)?

Don't expect so fast a response this time -- it's sleep time in this
timezone :-)

Cheers,
John




More information about the Python-list mailing list