January 2000
Intermediate to advanced
672 pages
21h 46m
English
Start up PythonWin and enter the following:
>>> from win32com.client import Dispatch
>>> xlApp = Dispatch("Excel.Application")
>>> xlApp.Visible = 1
>>> xlApp.Workbooks.Add()
<win32com.gen_py.Microsoft Excel 8.0 Object Library.Workbook>
>>>There will be a few-second pause before Excel starts. You should see
Excel appear when you enter xlApp.Visible
=
1, but with an empty main
window; the final line creates a blank workbook with three sheets.
Note that the return value of Add
is informative. This is part of what Makepy does for you;
if you had not run it, you’d get a less informative string
back. By the way, we’ve made Excel visible for teaching
purposes; if you just want to manipulate data, keep it hidden and
save processor cycles.
Read now
Unlock full access