Dummy explanation to win32com needed

Discussion in 'Python' started by korean_dave, Oct 22, 2008.

  1. korean_dave

    korean_dave Guest

    Hi. I need a dummy's explanation to utilizing the win32com component
    to access Microsoft Excel.

    So far, I have this code.

    import win32com.client
    xl = win32com.client.Dispatch("Excel.Application")
    xl.Visible = 1

    workbook = xl.Workbooks.Open("C:\test.xls")

    Now, my question is, where do I find the snytax I can use to access
    such functions like workbook.ActiveSheet.Cells(1,1).Value etc...

    I need a reference to the API I can utilize.

    Where can I find this?

    Thanks guys,
    -Dave
    korean_dave, Oct 22, 2008
    #1
    1. Advertising

  2. korean_dave

    Darcy Mason Guest

    On Oct 22, 3:43 pm, korean_dave <> wrote:
    > Hi. I need a dummy's explanation to utilizing the win32com component
    > to access Microsoft Excel.
    >
    > So far, I have this code.
    >
    >     import win32com.client
    >     xl = win32com.client.Dispatch("Excel.Application")
    >     xl.Visible = 1
    >
    >     workbook = xl.Workbooks.Open("C:\test.xls")
    >
    > Now, my question is, where do I find the snytax I can use to access
    > such functions like workbook.ActiveSheet.Cells(1,1).Value etc...
    >
    > I need a reference to the API I can utilize.
    >
    > Where can I find this?
    >
    > Thanks guys,
    > -Dave


    I haven't used this in quite some time, but if I recall correctly, it
    simply follows the object model as found in Excel Help | Visual Basic
    Reference, or go into the Excel code editor (alt-F11)and use the
    object browser. One thing to be aware of, IIRC, is that in VB you can
    leave out some default names (like .Value, .Item for collections) but
    these must be explicitly referenced when called using win32com.
    Darcy Mason, Oct 23, 2008
    #2
    1. Advertising

  3. korean_dave

    Tim Golden Guest

    korean_dave wrote:
    > Hi. I need a dummy's explanation to utilizing the win32com component
    > to access Microsoft Excel.
    >
    > So far, I have this code.
    >
    > import win32com.client
    > xl = win32com.client.Dispatch("Excel.Application")
    > xl.Visible = 1
    >
    > workbook = xl.Workbooks.Open("C:\test.xls")


    Well, for a start, you want to be raw-stringing that filename.
    (And, possibly, putting it somewhere other than the root
    of your c: drive ;) )


    > Now, my question is, where do I find the snytax I can use to access
    > such functions like workbook.ActiveSheet.Cells(1,1).Value etc...



    All the pywin32 / win32com stuff is doing is wrapping the
    Microsoft Excel Object Model. So, if you want to drive
    Excel you have two tools: the Macro Recorder in Excel
    itself; and Google:

    http://www.google.co.uk/search?q=site:microsoft.com excel object model



    TJG
    Tim Golden, Oct 23, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VK
    Replies:
    1
    Views:
    431
    Richard Tobin
    May 18, 2006
  2. Replies:
    9
    Views:
    371
    Christian Bau
    Feb 16, 2006
  3. Gina_Marano

    XSL help needed for dummy

    Gina_Marano, May 30, 2007, in forum: XML
    Replies:
    2
    Views:
    391
    roy axenov
    May 31, 2007
  4. NoNeYa
    Replies:
    42
    Views:
    1,189
    John W. Kennedy
    Aug 22, 2007
  5. korean_dave
    Replies:
    0
    Views:
    373
    korean_dave
    May 19, 2008
Loading...

Share This Page