The Close method is used to close a workbook
If the workbook is “dirty” (needs to be saved), Excel will display its standard prompt
To avoid seeing this message, you can 1) Save the file first, 2) Change the DisplayAlerts property, 3) Use the SaveChanges argument of the Close method, or 4) set the Saved property to True.
Save the File First
Application.DisplayAlerts = False
Note that this won’t save the changes, it will close the workbook without saving. Also note that since I’m closing ThisWorkbook, I don’t set DisplayAlerts back to True. The workbook with the code will be closed and that line would never execute. If you’re closing a different workbook, it’s a good idea to set DisplayAlerts back to True. That said, this is the worst option of the three and I never use it.
Using The Argument
You can set SaveChanges to either True of False depending on what you want to do.
ThisWorkbook.Saved = True
Setting Saved to True tells Excel that the workbook does not need to be saved, even if it does. Needless to say, the workbook will be closed with changes since the last save lost with this method.
Personally, I use method 3 almost exclusively.