Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone,
I would like to close ALL instances of Excel... I am able to close all workbooks within an instance of Excel but cannot close workbooks in other instances of Excel... Is there a way to scan all open windows? Or even better, to scan all open instances of Excel only? Help would be much appreciated. Thanks in advance, Jason |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This code is to run in Excel VBA ?
You want to close your own instance ? Depending on the above GetObject may not be the answer, as you cannot stipulate which instance gets returned. Maybe use the API FindWindow with "XLMAIN" and SendMesssage with "WM_CLOSE" ? NickHK "spIky haIred" wrote in message oups.com... Hi everyone, I would like to close ALL instances of Excel... I am able to close all workbooks within an instance of Excel but cannot close workbooks in other instances of Excel... Is there a way to scan all open windows? Or even better, to scan all open instances of Excel only? Help would be much appreciated. Thanks in advance, Jason |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, that should be PostMessage not SendMessage.
http://support.microsoft.com/?kbid=176391 http://vb-helper.com/howto_terminate_process.html But you would still need to check if the Excel instance is yours, if running in Excel/VBA. NickHK "NickHK" wrote in message ... This code is to run in Excel VBA ? You want to close your own instance ? Depending on the above GetObject may not be the answer, as you cannot stipulate which instance gets returned. Maybe use the API FindWindow with "XLMAIN" and SendMesssage with "WM_CLOSE" ? NickHK "spIky haIred" wrote in message oups.com... Hi everyone, I would like to close ALL instances of Excel... I am able to close all workbooks within an instance of Excel but cannot close workbooks in other instances of Excel... Is there a way to scan all open windows? Or even better, to scan all open instances of Excel only? Help would be much appreciated. Thanks in advance, Jason |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Application.Quit is one way, but you might get a few dialog boxes to respond
to if you don't either save the workbooks or mark them as saved before you apply it. "NickHK" wrote: Sorry, that should be PostMessage not SendMessage. http://support.microsoft.com/?kbid=176391 http://vb-helper.com/howto_terminate_process.html But you would still need to check if the Excel instance is yours, if running in Excel/VBA. NickHK "NickHK" wrote in message ... This code is to run in Excel VBA ? You want to close your own instance ? Depending on the above GetObject may not be the answer, as you cannot stipulate which instance gets returned. Maybe use the API FindWindow with "XLMAIN" and SendMesssage with "WM_CLOSE" ? NickHK "spIky haIred" wrote in message oups.com... Hi everyone, I would like to close ALL instances of Excel... I am able to close all workbooks within an instance of Excel but cannot close workbooks in other instances of Excel... Is there a way to scan all open windows? Or even better, to scan all open instances of Excel only? Help would be much appreciated. Thanks in advance, Jason |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi all, thanks for your help on this, i have tried application.quit but
it still leaves the other "instances" of excel open... Nick i shall try your solutions, thanks again |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry guys, couldnt get the solutions to work...
any more advice? let me rephrase my question... probably wasn't clear at the start.. im trying to close all excel workbooks in any number of windows using either excel vba or vbscript... thanks again |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry guys, couldnt get the solutions to work...
any more advice? let me rephrase my question... probably wasn't clear at the start.. im trying to close all excel workbooks in any number of windows using either excel vba or vbscript... thanks again |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry guys, couldnt get the solutions to work...
any more advice? let me rephrase my question... probably wasn't clear at the start.. im trying to close all excel workbooks in any number of windows using either excel vba or vbscript... thanks again |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If two instances of Excel open top right "X" close only one | Excel Discussion (Misc queries) | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
I can't save a file unless I close all excel instances or it's th. | Excel Discussion (Misc queries) | |||
Close all Instances of Excel | Excel Programming | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel |