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 2 2061
ttt
Anyone? Really need to figure this out.
Thanks
"Marc" <mn******@airmail.net> wrote in message
news:43**************************@posting.google.c om... 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
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-onli...pp_Methods.htm
which suggests you should look at the OnWorkbookBeforeClose
event.
Hope that helped.
Andrew da***@dalkescientific.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richie |
last post by:
I want to close excel application from C#, this is the piece of code I
am trying
"System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);"
GC.Collect();
It ain't working ! Any ideas...
|
by: Denis Brkljacic |
last post by:
Hello,
Please, if enaybody could help a little bit... Namely, I need to build C#
ASP.NET Web that opens some Template.xls, write something to it and then
closes it (and releases the objects)....
|
by: pmud |
last post by:
Hi,
I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the...
|
by: Jerry J |
last post by:
I am sending Excel reports to web clients. Excel opens in internet explorer
displaying multiple sheets. It is pretty simple to do and works well. To do
it, a client clicks a link to an ASPX page...
|
by: Randall Arnold |
last post by:
I have a VB.net assembly that manipulates excel data. At the end of data
processing, the user has the option to view the spreadsheet, which is at that
time open and not visible. So at this point...
| |
by: liam_jones |
last post by:
I'm very new to Python, well IronPython to precise, and have been
having problems when using Excel.
The problem I'm having is the closing of my Excel object. I'm able to
successfully quit the...
|
by: Doug Glancy |
last post by:
I got the following code from Francesco Balena's site, for disposing of Com
objects:
Sub SetNothing(Of T)(ByRef obj As T)
' Dispose of the object if possible
If obj IsNot Nothing AndAlso...
|
by: rlntemp-gng |
last post by:
RE: Access 2003/Excel 2003
Problem:
After I close the Access application completely, I go out to the Task
Manager and there is an Excel.exe object still sitting out there.
My Access...
|
by: =?Utf-8?B?VGVycnkgSG9sbGFuZA==?= |
last post by:
I have a vb.net app that opens an excel worksheet, reads data and then closes
the sheet. Im noticing that the Excel process is still running after I have
closed and disposed of my excel objects.
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |