In attempting to auto fit a range of columns, Excel 2011 on Mac stops responding, and the Python call times out.
.workbooks[1].active_sheet.cells['$A$1:$D$1048576'].rows.autofit()
from xlwings import Workbook, Sheet, Range, Chart
wb = Workbook()
Range('A1').value = [['Foo 1', 'Foo 2', 'Foo 3'], [10.0, 20.0, 30.0]]
Range('A1').autofit() # this works
Range('A:D').autofit() # Excel stops responding
---------------------------------------------------------------------------
CommandError Traceback (most recent call last)
<ipython-input-13-44bc97f3eefb> in <module>()
----> 1 Range('A:D').autofit()
//anaconda/lib/python2.7/site-packages/xlwings/main.pyc in autofit(self, axis)
620
621 """
--> 622 xlplatform.autofit(self, axis)
623
624 def __repr__(self):
//anaconda/lib/python2.7/site-packages/xlwings/_xlmac.pyc in autofit(range_, axis)
274 range_.xl_range.columns.autofit()
275 if not range_.is_column():
--> 276 range_.xl_range.rows.autofit()
277
278
//anaconda/lib/python2.7/site-packages/aeosa/appscript/reference.pyc in __call__(self, *args, **kargs)
496 return
497 raise CommandError(self, (args, kargs), e, self.AS_appdata)
--> 498 raise CommandError(self, (args, kargs), e, self.AS_appdata)
499
500 def AS_formatcommand(self, args):
CommandError: Command failed:
OSERROR: -1712
MESSAGE: Apple event timed out.
COMMAND: app(u'/Applications/Microsoft Office 2011/Microsoft Excel.app').workbooks[1].active_sheet.cells['$A$1:$D$1048576'].rows.autofit()
In attempting to auto fit a range of columns, Excel 2011 on Mac stops responding, and the Python call times out.
Could this be due to the block selection instead of a column selection?
IPython session: