"koia" <[EMAIL PROTECTED]> wrote:

>Hi,
>
>I am using win32com for the Python interface to my Excel shreadsheets.
>
>When I turn on Macro recordiong in Excel while filling a rectangle with
>text information, a part of the VB code produced is the following:
>
>    With Selection.Characters(Start:=1, Length:=11).Font
>        .Name = "Arial"
>        .FontStyle = "Normal"
>        .Size = 10
>        .Strikethrough = False
>        .Superscript = False
>        .Subscript = False
>        .OutlineFont = False
>        .Shadow = False
>        .Underline = xlUnderlineStyleNone
>        .ColorIndex = xlAutomatic
>
>What is the syntax for passing the parameters Start:=1, Length:=11 to
>VB from a Python function, if I want to control these properties of the
>text in the Excel spreadsheet?

If you check the object model documentation, you'll find that "Start" and
"Length" are the only two parameters to Characters, so Characters(1,11)
should work.

However, in a few minutes of experimentation, I was unable to get
Characters to accept any parameters from Python.  I can set the whole cell
to bold by this:

  xl = win32com.client.Dispatch("Excel.Application")
  wb = xl.ActiveWorkbook
  ws = wb.Worksheets(1)
  r = ws.Range("A1")
  r.Characters.Font.Bold = True
-- 
- Tim Roberts, [EMAIL PROTECTED]
  Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to