G
Guest
Guest
Hello.
I have a situation
I have a Macro that loads a form where the user can choose what type of data he wants to load, the just has to click on the appropriate button and the data will be loaded.
One of the buttons is labelled 'Exit' and what this does is close Excel altogehter.
I use Application.Quit as the command
A colleague put a case forward that if the User has the Makro open and he decides to open a standard excel file, and then he chooses to exit the Makro, then both files will close because of the command Application.Quit
I would like the program to run so that when the Makro is loaded without any additional Excel files being opened and the user clicks on 'Exit' that Excel will close. But if an additional file is already open and the user loads the Makro and then decides to 'Exit' is it possible to check wether there are any Workbooks other than the Makro workbook present ?if so then only do an Activewindow.Close, if not then use the Application.Quit
Does anybody know how to put that into code?
I would be grateful for any help you can give.
Thanks.
I have a situation
I have a Macro that loads a form where the user can choose what type of data he wants to load, the just has to click on the appropriate button and the data will be loaded.
One of the buttons is labelled 'Exit' and what this does is close Excel altogehter.
I use Application.Quit as the command
A colleague put a case forward that if the User has the Makro open and he decides to open a standard excel file, and then he chooses to exit the Makro, then both files will close because of the command Application.Quit
I would like the program to run so that when the Makro is loaded without any additional Excel files being opened and the user clicks on 'Exit' that Excel will close. But if an additional file is already open and the user loads the Makro and then decides to 'Exit' is it possible to check wether there are any Workbooks other than the Makro workbook present ?if so then only do an Activewindow.Close, if not then use the Application.Quit
Does anybody know how to put that into code?
I would be grateful for any help you can give.
Thanks.