Tim,
Thanks for the reply, the test case now passes.
However, our internal application is still failing.
code snippet:
import win32com
import win32com.client.dynamic
import pythoncom
from pywintypes import Unicode
from win32com.client import gencache
xl = win32com.client.dynamic.Dispatch("Excel.Application")
xl.Visible = 1
xlBook = xl.Workbooks.Open('C:\\test.xls')
xlSheet = xlBook.Worksheets(1)
print xlSheet.Name
xlSheet.Cells(1,1).Value = "Hello World"
print xlSheet.Cells(1,1).Value
lastCol = 14
lastRow = xlSheet.Cells.Find('Hello World',xlSheet.Cells(1, 1), 1, 1).Row
data = xlSheet.Range(xlSheet.Cells(1,1),
xlSheet.Cells(lastRow,lastCol)).Value
xl.Workbooks(1).Close(SaveChanges = 1)
xl.Quit()
/snippet
When this is run, I receive the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\python24\lib\site-packages\win32com\test\testExcel.py", line 16,
in ?
lastRow = xlSheet.Cells.Find('Hello World',xlSheet.Cells(1, 1), 1,
1).Row
File
"c:\python24\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-00
0000000046x0x1x5\Range.py", line 197, in Find
, MatchCase, MatchByte, SearchFormat)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None,
None,
0, -2147352565), None)
I believe this error is coming from Excel, but I am not sure why.
The offending line works with Excel 2000 but not 2003.
Thanks,
Mike
-----Original Message-----
From: Tim Roberts [mailto:[EMAIL PROTECTED]
Sent: Friday, September 16, 2005 3:17 PM
To: [email protected]
Subject: [python-win32] testMSOffice.py and Excel 2003
On Thu, 15 Sep 2005 15:24:52 -0400, "Cavanagh, Mike"
<[EMAIL PROTECTED]> wrote:
>We have a couple of internal applications that are written in Python and
>have always worked with Excel 2000.
>
>We are 'upgrading' to Excel 2003 and in my pre-rollout testing, our
>applications are failing.
>
>Using the testMSOffice.py test case, I receive the following:
>
>
...
> File "C:\Python24\Lib\site-packages\win32com\test\testMSOffice.py", line
>96, in TextExcel
> xl.Workbooks().Add()
> File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line
165,
>in __call__
> return
>self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.
>defaultDispatchName,None)
>com_error: (-2147352562, 'Invalid number of parameters.', None, None)
>
>I'm beginning to pull my hair out here, any help would be appreciated.
>
Remove the inner set of parentheses:
xl.Workbooks.Add()
Workbooks is a collection object, not a method.
--
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32