Yes, Mike,
Others pointed that out as well.
For good reason.
The difficulty is that they are all in VBAs. Most of them can be translated to Python fairly easily, and some I can get from looking at the recorded macro - but some requires quite a bit of head scratching.
For instance, I wanted to figure out how create a new window. So, I went through the record macro process and looked at the VBA code, it says:
ActiveWindow.NewWindow
app.ActiveWindow.NewWindow()
Okay. Now what???
And for switching window, it says:
Windows("Book1:1").Activate
app.Windows.Item("Book1:1").Activate()
---------------------------------------------------------------------
from win32com.client import Dispatch, constants
app = Dispatch("Excel.Application") app.Visible = True
workbook = app.Workbooks.Add()
defaultWorksheet = workbook.Worksheets(1)
app.ActiveWindow.NewWindow() app.ActiveWindow.NewWindow()
# grab the capation (like 'Book1:1') from one of the windows thridWindowsCaption = app.Windows[2].Caption
print thridWindowsCaption app.Windows.Item(thridWindowsCaption).Activate()
------------------------------------------------------------------------
Sometimes its useful to look in the file generated by makepy. It details
all the classes and their methods AND there are annotations in the form
of comments. Having said that, if you've never looked in a makepy generated module before, you're in for a shock - it takes a while before you figure out what you are looking at.
When you get stuck, trial & error and a good debuger are your friend.
-- Mike -- http://mail.python.org/mailman/listinfo/python-list