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
CodePudding user response:
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.