Strange discrepancy between Excel VBA and Python

Moore, Paul Paul.Moore at atosorigin.com
Wed Mar 12 14:36:51 CET 2003


When I try to resize a range in Python, I get a different answer from VBA.

Simple example, get a block of 10 cells at the top left of sheet 1 (I know
I can do this other ways, but it illustrates the point)

>From the Excel VBA immediate window:

? Sheets(1).Cells(1,1).Resize(10,10).Address
$A$1:$J$10

>From PythonWin:

>>> xl = Dispatch("Excel.Application")
>>> xl
<win32com.gen_py.Microsoft Excel 9.0 Object Library._Application instance at 0x72000536>
>>> xl.Sheets(1).Cells(1,1).Resize(10,10).Address
u'$J$10'

(You note that I have run Makepy).

Why is Python showing this as a single cell???

Thanks for any help, I really hate the Excel object model :-(

Paul





More information about the Python-list mailing list