It's still I, Miville

Simon Bayling sfb at alysseum.com
Sun Nov 2 13:15:26 CET 2003


François Miville-Dechêne  <fmiville at sympatico.ca> wrote in
news:mailman.333.1067742542.702.python-list at python.org: 

> To take on another subject, an object-oriented language such as yours
> should explicitly tackle the Microsoft Office constructs

Python has been able to command Microsoft Office programs for the past
3-4 years, at least. The book "Python Programming on Win32" by Mark
Hammond and Andy Robinson, published in Jan 2000 covers it. 

Install Python and the Win32All extensions.

>>> from win32com.client import Dispatch
>>> word = Dispatch('Word.Application')
>>> word.Visible = 1

>>> doc = word.Documents.Add()
>>> doc.Range(0,0).InsertAfter('Hello, here is some text in a Word    
>>> 	document') 

You can also explore various Office scripting examples at microsoft.com
and translate them into Python without too much hassle. 

-- Simon.




More information about the Python-list mailing list