Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Exit application without closing all the files

I am trying to provide an option to my users to save and close excel application after they finish to complete a specific form. However, it is closing the whole Excel and not only the current Excel workbook that they just used. In other words, if they have 4 different Excel files opened, it will close all of them and not only the current workbook. What am I doing wrong?
This is the code that I am using:

ThisWorkbook.Application.Quit
    ThisWorkbook.Save

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You must not quit the Application – but close the workbook:

ThisWorkbook.Close SaveChanges:=True

will save and close the workbook.

If it is the only open workbook, Excel gets closed as well.
If not Excel and the other workbooks are still open.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading