This post will show you how to use a VBA Macro to save an Excel file and overwrite any existing file without a prompt so that you are going to get the little window that says file already exists do you want to overwrite it. If there is a way that disabling Save prompt when you close your current workbook in Excel. of course yes, the below steps will guide you two VBA codes to disable the save as prompt.
Disable Save Prompt with VBA Code
If you want to disable save prompt without saving changes directly, and you can do the following steps:
Step 1: Enter Microsoft Visual Basic for Applications window via Developer->Visual Basic. You can also press Alt + F11 keys simultaneously to open it.
Step 2: In Microsoft Visual Basic for Applications window, click Insert->Module, enter below code in Module1:
Sub save_close() ThisWorkbook.Saved = True End Sub
Step 3: Save VBA macro, see screenshot below. And then quit Microsoft Visual Basic for Applications.
If you want to disable save prompt with saving changes when closing window or workbook, and you can refer to the above steps, but instead of the below VBA codes.
Sub save_close() If ThisWorkbook.Saved = False Then ThisWorkbook.Save End If End Sub
If you want to save it as another file and you can use the below VBA Macro:
Sub saveas_close() ThisWorkbook.SaveAs "c:\", 51 End Sub