Dummy explanation to win32com needed

Tim Golden mail at timgolden.me.uk
Thu Oct 23 03:53:52 EDT 2008


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%3Amicrosoft.com+excel%20object%20model



TJG



More information about the Python-list mailing list