Tim Roberts wrote: >Niemann, Hartmut wrote: >>I want to create an Excel file through the python COM interface. >>I can open the file, fill the cells, save the file. >>Now I want to color single characters in the cell content. >>In VBA ( see >>http://stackoverflow.com/questions/7618121/excel-vba-change-color-of-certain-characters-in-a-cell) >>I would do >>Cell.Characters(i, 1).Font.Color = vbRed >>How does that translate to Python? >>mycell.Characters[x:y] does not work, nor anything else I tried.
>That's interesting. Theoretically, the Characters object should have a >__call__ method, so you could call it exactly like in VB: > Cell.Characters(i,1) >but I don't see that in the generated COM interface. That is what the error message is: File "D:\PRJ\DPS\bin\itm_diff.py", line 252, in diff_output_table_excel charrange = chars(1,2) ## this should work but doesn''t yet. AttributeError: Characters instance has no __call__ method I tried again and removed the make_py generated interface, now I get a different error: File "D:\PRJ\DPS\bin\itm_diff.py", line 252, in diff_output_table_excel charrange = chars(1,2) ## this should work but doesn''t yet. File "D:\bin\Python27\lib\site-packages\win32com\client\dynamic.py", line 192, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) pywintypes.com_error: (-2147352573, 'Mitglied nicht gefunden.', None, None) >That's going to be an ugly one to chase down. Where can we start the chase? With best regards Hartmut Niemann _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32