Dummy explanation to win32com needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • korean_dave

    #1

    Dummy explanation to win32com needed

    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("Exce l.Application")
    xl.Visible = 1

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

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

    I need a reference to the API I can utilize.

    Where can I find this?

    Thanks guys,
    -Dave
  • Darcy Mason

    #2
    Re: Dummy explanation to win32com needed

    On Oct 22, 3:43 pm, korean_dave <davidrey...@gm ail.comwrote:
    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("Exce l.Application")
        xl.Visible = 1
    >
        workbook = xl.Workbooks.Op en("C:\test.xls ")
    >
    Now, my question is, where do I find the snytax I can use to access
    such functions like workbook.Active Sheet.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.

    Comment

    • Tim Golden

      #3
      Re: Dummy explanation to win32com needed

      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("Exce l.Application")
      xl.Visible = 1
      >
      workbook = xl.Workbooks.Op en("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.Active Sheet.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:

      Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.




      TJG

      Comment

      Working...