Notifications
Clear all
VBA & Macros
2
Posts
2
Users
0
Reactions
7
Views
Topic starter
Hi,
I have created a Save and Close Macro (Below), So that the command button been assigned for the user to use before exiting
ActiveWorkbook.Close SaveChanges:=True
What Im trying to prevent is the Close "X" button to be pressed and for user to stop save as and to use a MSG "Please use the save and Close button". is there a code that when you press "X" close button that you cant close unless you hit Save and close command button.
Thanks
Steve
Posted : 25/02/2020 6:48 pm
Hi Steve,
In the ThisWorkbook module use this event:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
' YOUR CODE GOES HERE
End Sub
Regards
Phil
Posted : 26/02/2020 3:06 am