Some troubles with Excel formatting a cell in python

Andreas Maurer amapy at snafu.de
Thu May 16 11:45:40 EDT 2002


Hi folks,

I tried to "convert" an Excel-macro to python.
This worked well, 'till I found this VBA-Codeline:

    With ActiveCell.Characters(Start:=8, Length:=15).Font
        .Name = "Arial"
        .FontStyle = "Standard"
etc, etc...

I "translated" this line to python like this:

Excel.ActiveCell.Characters(Start:=8, Length:=15).Font.FontStyle =
"Standard"

when I start this line in the Interactive Window of pythonwin, I got this
error-message:

>>> Excel.ActiveCell.Characters(Start:=8, Length:=15).Font.FontStyle =
"Standard"
Traceback (  File "<interactive input>", line 1
    Excel.ActiveCell.Characters(Start:=8, Length:=15).Font.FontStyle =
"Standard"
                                     ^
SyntaxError: invalid syntax

I was looking in the msdn and other sources, but I've not found a solution
yet to avoid
the trouble with the Characters-methode.

I'm appreciate for any hint.

Andreas





More information about the Python-list mailing list