Excel Character object through COM

K

Krisz

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("Sheet1").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):
<win32com.gen_py.Microsoft Excel 9.0 Object Library.Characters instance
at 0x19420904>
Traceback (most recent call last):
File "<interactive 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
 
M

Max Erickson

Traceback (most recent call last):
File "<interactive 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.

try GetCharacters(1,1)

max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top