Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is there a command line switch that will prevent Excel from opening multiple instances of the application? I develop under excel and use an interface to a thrid party middleware product. If the user opens multiple copies of Excel then the middleware doesn't know which one to use and it's operations tend to become unpredictable. If there isn't a way to prevent multiple instances, how about a way to detect it? - Rm |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am not aware of a way to limit excel to one instance. I did have to deal
with a similar problem and initially we tried using GetObject to get 'other' excel instance, but it did not always work. We ended up using Windows API calls to get processes and then check for excel.exe by. If there's an elegant way to reliably do this then I am interested as well. -- www.alignment-systems.com "Robert Mulroney" wrote: Is there a command line switch that will prevent Excel from opening multiple instances of the application? I develop under excel and use an interface to a thrid party middleware product. If the user opens multiple copies of Excel then the middleware doesn't know which one to use and it's operations tend to become unpredictable. If there isn't a way to prevent multiple instances, how about a way to detect it? - Rm |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
Thanga posted a C# routine here in message, see message #9 date view http://tinyurl.com/9pbjv I couldn't get it to work but probably due to my minimal knowledge of making anything work in C# ! I have an "in-elegant" VBA method which is reliable enough for my purposes though I wouldn't distribute as a production app, at least not as is. Maybe a timing issue, occasionally fails first time though normally works on second attempt. I briefly described it in message #6 of same thread. Regards, Peter T pmbthornton gmail com "John.Greenan" wrote in message ... I am not aware of a way to limit excel to one instance. I did have to deal with a similar problem and initially we tried using GetObject to get 'other' excel instance, but it did not always work. We ended up using Windows API calls to get processes and then check for excel.exe by. If there's an elegant way to reliably do this then I am interested as well. -- www.alignment-systems.com "Robert Mulroney" wrote: Is there a command line switch that will prevent Excel from opening multiple instances of the application? I develop under excel and use an interface to a thrid party middleware product. If the user opens multiple copies of Excel then the middleware doesn't know which one to use and it's operations tend to become unpredictable. If there isn't a way to prevent multiple instances, how about a way to detect it? - Rm |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks guys. I've explored some options that use the Windows API to check the list of running processes. I don't really want to give my users the capability to run scripts that simply terminate processes. That could lead to some, well.... "problems". I've noticed that a lot of objects in excel have an "Application" property. There must be someway that I can compare "Applications" for each open document and terminate all but one using the "Application.Quit". That seems a little safer to me. Any thoughts? - Rm |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I suppose if you are administrating use of Excel in your organisation it
might be OK for you to close your colleagues' Excel instances in an orderly way. But if that's not the case my "thought", as you asked, would be don't even consider doing that! In your OP you said "I develop under excel and use an interface to a thrid party middleware product" I don't follow the reason you need to close all but one instance, and the criteria by which you would leave a given instance open. If you know the FullName (not simply file name) of a particular file that's of interest, if open it's normally possible to attach a ref to its instance with GetObject(FullName).Parent. Or maybe just start your own instance. Regards, Peter T "Robert Mulroney" '''' wrote in message ... Thanks guys. I've explored some options that use the Windows API to check the list of running processes. I don't really want to give my users the capability to run scripts that simply terminate processes. That could lead to some, well.... "problems". I've noticed that a lot of objects in excel have an "Application" property. There must be someway that I can compare "Applications" for each open document and terminate all but one using the "Application.Quit". That seems a little safer to me. Any thoughts? - Rm |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps I didnt make it clear initially, the problem I have stems from
having multiple instances of the €śExcel Task€ť running at the same time, not multiple xl documents. To see what I mean: Double click your excel icon. Minimise the window and double click the icon again. Go to your task manager (sort by task name) and youll see that there are two instances of Excel processing at the same time. Thats want I want to prevent, not multiple windows on the start bar. I don't have some malicious intent on making life difficult by randomly closing peoples work for them. It would be much better to prevent a new excel instance starting then have to close it after start €“ hence my original question. The idea of closing tasks came up if it is not possible to prevent multiple start-ups. In that sence my criteria for closing excel apps would be "if one is running close the new one and maximise the old" All Office products that run concurrently seem to €śknow€ť about each other. They interact and react to each other. For example Outlook uses Word to format emails and spellcheck. Thats one of the coolest things about developing with Office tools. Its this interaction between two instances of Excel that seem to be causing the problem, confusing the 3rd party product. Hopefully I'm making more sence. Thanks for you help. - Rm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Prevent multiple instances in Excel 2007 | Excel Discussion (Misc queries) | |||
Excel starting multiple instances of IE | New Users to Excel | |||
Prevent Excel closing all workbook instances when clicking on "X" | Excel Discussion (Misc queries) | |||
Files open when starting-How to prevent | Setting up and Configuration of Excel | |||
Prevent Excel creating new instances of Excel | Excel Programming |