PythonCOM and Office. Arrgh!

Emile van Sebille emile at fenx.com
Tue Jul 10 08:10:39 EDT 2001


This worked for me.  Win2ksp1, excel2k, Python 2.1

>>> import win32com.client
>>> xl = win32com.client.Dispatch("Excel.Application")
>>> xlc = win32com.client.constants
>>> xl.Workbooks.Open('test',Password='fred')
<COMObject Open>
>>> xl.Visible=1

What do you get when you try this?

--

Emile van Sebille
emile at fenx.com

---------
"Matthew" <matthewm at ihug.co.nz> wrote in message
news:3B4A7C91.44680652 at ihug.co.nz...
> Hi everyone,
>
> A few more hours and my mind will be gone; burnt to a frazzle by this
> most annoying, frustarting problem.
>
> No matter what I try, I CAN NEVER get named keyword arguments to do
> anything via PythonCOM Excel automation.
>
> xlapp.Workbooks.Open("D:\\Fred.xls", Password='fred')
> profers no error. The xcel window opens with Password Dialog  opem. Type
> in 'fred' and s/s loads up. Named arg passed in call apparently ignored.
>
> xlapp.Workbooks.Open("D:\\Fred.xls", password='fred')
> generates error - Open got unexpected keyword argument 'password', so it
> seems to me that somethings going on with passed named args
>
> I've tried 10s of different xcel functions but with identical results.
> Named args do zippo. Spell a keyword arg incorrectly and you get
> reprimanded.
>
> I've tried under NT4/2000 with both ActiveState2.0 build 203 &
> ActiveState21.- build 210.
>
> What am I overllooking/missing? Please help before it's too late...
>
> Thanks, matthew.
>




More information about the Python-list mailing list