|Use Alt-F11 to open the VBA editor.|
Double click the ThisWorkbook module.
Paste the code below into the pane that opens.
Close the workbook.
As always, I suggest that you try this code in a backup copy of your workbook. Nothing you get from a stranger in a forum should be considered safe.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.