Strange discrepancy between Excel VBA and Python

Paul Moore gustav at morpheus.demon.co.uk
Wed Mar 12 23:19:07 CET 2003


"Moore, Paul" <Paul.Moore at atosorigin.com> writes:

> 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???

I discovered that there is a GetResize method which does work. But I'm
not sure what Resize() is meant for, in that case. Can anyone explain?

Thanks,
Paul
-- 
This signature intentionally left blank




More information about the Python-list mailing list