COM - Excel: What happens if users closes workbook externally?
Andrew Dalke
adalke at mindspring.com
Mon Oct 13 00:32:39 EDT 2003
Marc
> Anyone? Really need to figure this out.
On the theory that a wrong answer will bring responses from people
who actually know the answer ...
> > I've tried different ways of checking to see if the workbook is still
> > active, but nothing has worked. Is there anyway to bind the 'exit' and
> > 'x' from the excel spreadsheet to functions within my python script so
> > that I'll know when the workbook is closed?
There should be a way to receive the close window event. There
is a test file in the win32 distribution named 'testMSOfficeEvents.py'
which has handlers like
def OnQuit(self):
self.seen_events["OnQuit"] = None
stopEvent.set()
Given some of the other events in that file I found
http://www.as-ltd.co.uk/xllplus-online/CXllApp_Methods.htm
which suggests you should look at the OnWorkbookBeforeClose
event.
Hope that helped.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list