COM - Excel: What happens if users closes workbook externally?

Marc losnations at comcast.net
Mon Oct 13 00:15:55 EDT 2003


ttt

Anyone? Really need to figure this out.

Thanks

"Marc" <mnations at airmail.net> wrote in message
news:4378fa6f.0310101528.12d2c170 at posting.google.com...
> Hi all,
>
> I have a problem with managing the interchange between COM/Excel and
> Python if the user closes the workbook externally.
>
> Everything works fine as long as the user only uses the exit keys I've
> provided to close the Excel apps and COM interfaces. But I really need
> the ability to manage the workbook if someone closes it using the
> 'exit' command or the right/upper 'x' from within the excel
> spreadsheet.
>
> When that happens, the workbook is lost, but the interface between
> python and the COM server stays open. So when I go back later and try
> to update the sheet, of course it's not there. But I don't know how to
> monitor the status of the workbook to see if I need to create another
> one or use the initial one.
>
> 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? Or is there a better way
> to handle this scenario. Unfortunately, simply telling them not to do
> it that way is not an option.
>
> Thanks ahead of time,
> Marc






More information about the Python-list mailing list