Hi!
Maybe this question is already answared somewhere, but I could not find
it:
I want to modify one of the letters of a text of a Excel cell through
COM; let's say to make it red. The VB reference tells that it can be
managed with:
With Worksheets("She et1").Range("A1 ")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
However when I try the similar in Python (I used the 'COM Makepy
utility' of Pythonwin) I got the following (Here 'A' is a class that
wraps the 'com' things):
[color=blue][color=green][color=darkred]
>>> A.book.Workshee ts(1).Range("a1 ").Characte rs[/color][/color][/color]
<win32com.gen_p y.Microsoft Excel 9.0 Object Library.Charact ers instance
at 0x19420904>
[color=blue][color=green][color=darkred]
>>> A.book.Workshee ts(1).Range("a1 ").Characters(1 ,1)[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
AttributeError: Characters instance has no __call__ method
So my question is that am I doing something wrong or there is a
different way to modify the color of a charater through COM.
Thank you.
Regards, Krisztian
Maybe this question is already answared somewhere, but I could not find
it:
I want to modify one of the letters of a text of a Excel cell through
COM; let's say to make it red. The VB reference tells that it can be
managed with:
With Worksheets("She et1").Range("A1 ")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
However when I try the similar in Python (I used the 'COM Makepy
utility' of Pythonwin) I got the following (Here 'A' is a class that
wraps the 'com' things):
[color=blue][color=green][color=darkred]
>>> A.book.Workshee ts(1).Range("a1 ").Characte rs[/color][/color][/color]
<win32com.gen_p y.Microsoft Excel 9.0 Object Library.Charact ers instance
at 0x19420904>
[color=blue][color=green][color=darkred]
>>> A.book.Workshee ts(1).Range("a1 ").Characters(1 ,1)[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
AttributeError: Characters instance has no __call__ method
So my question is that am I doing something wrong or there is a
different way to modify the color of a charater through COM.
Thank you.
Regards, Krisztian
Comment