Hi All,

I was expecting the code below to work. Basically I casting a
System.__ComObject into a Range Interface (
https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range_members(v=office.14).aspx).
There should be an indexer but I can't seem to get it to work?

Thanks,

Phat


from PyExcel import PyAddin

import Microsoft.Office.Interop.Excel as Excel

app = Excel._Application(PyAddin.CurrentInstance.ExcelApp)

selection = Excel.Range(app.Selection)



In [5]: selection[1,1]

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-5-bb1b652c6740> in <module>()

----> 1 selection[1,1]



TypeError: 'Range' object is not subscriptable



In [6]: selection.Cells[1,1]

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-6-f8b14ac4d116> in <module>()

----> 1 selection.Cells[1,1]



TypeError: unindexable object



In [7]: selection.Cells(1,1)

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-7-e8b900b98026> in <module>()

----> 1 selection.Cells(1,1)



TypeError: object is not callable
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
https://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to