Hi,
[Windows 2000, build 2195, SP4; Python 2.4.1; pywin32 build 204]
I'm experimenting with accessing the contents of Excel workbooks. I've used
makepy to
build the Excel 10.0 library. Have successfully done various COM fiddling with
Excel
before with Python 2.3 & 2.4, and with Excel 9.0 and 10.0. Was working OK this
morning, right down to digging out the values of individual cells. However it's
suddenly
stopped working, right up the top.
(1) xl = win32com.client.Dispatch("Excel.Application")
(2) print repr(xl)
(3) xlwb = xl.Workbooks.Open(filename)
Before, line 2 would print this:
<win32com.gen_py.Microsoft Excel 10.0 Object Library._Application instance at
0x39073872>
and line 3 would work OK.
Now, line 2 prints this:
<COMObject Excel.Application>
and line 3 causes an exception:
File "com_read.py", line 21, in com_open_workbook
xlwb = xl.Workbooks.Open(filename)
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 489, in
__getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: Excel.Application.Workbooks
All I did between it working and not working was to shut down a few windows
before
shutting down the PC then I had an afterthought and ran my script again and
whammo!
I've since used makepy via the PythonWin tools menu to rebuild the Excel 10.0
library,
but that didn't help.
Any clues gratefully appreciated,
Cheers,
John
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32