Nach Excel schreiben
Verfasst: Donnerstag 5. April 2007, 18:20
Weiß jemand, warum am Ende mit range diese Fehlermeldung kommt,
während es mit xrange funktioniert???
->
Traceback (most recent call last):
File "excel.py", line 22, in <module>
for s in range(10):
File "C:\Python25\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-000000000046x0x1x5.py", line 22840, in __call__
, ColumnIndex)
File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 448, in _ApplyTypes_
dispid, 0, wFlags, retType, argTypes, *args),
com_error: (-2146827864, 'OLE error 0x800a01a8', None, None)
während es mit xrange funktioniert???
Code: Alles auswählen
# -*- coding: iso-8859-1 -*-
import win32com.client
import os
Fehler = False
try: ## Excel Anwendung öffnen
# NOTE - these 2 lines are copied verbatim from the output
# of makepy.py when run with the -i parameter.
from win32com.client import gencache
gencache.EnsureModule('{00020813-0000-0000-C000-000000000046}', 0, 1, 2)
Excel = win32com.client.Dispatch("Excel.Application")
Excel.Visible = True
except:
print "Fehler beim Versuch, Excel zu starten"
Fehler = True
if Fehler is False:
wbExcel = appExcel.Workbooks.Add()
wsExcel = wbExcel.Worksheets(1)
Cells=wsExcel.Cells
for s in range(10):
Cells(1,s+1).Value=s
Traceback (most recent call last):
File "excel.py", line 22, in <module>
for s in range(10):
File "C:\Python25\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-000000000046x0x1x5.py", line 22840, in __call__
, ColumnIndex)
File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 448, in _ApplyTypes_
dispid, 0, wFlags, retType, argTypes, *args),
com_error: (-2146827864, 'OLE error 0x800a01a8', None, None)