Reputation: 123
I'm using this macro in order to prevent a user from saving the workbook unless they accept the Terms and Conditions, annotated with a checkbox.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Please accept the terms and conditions"
Cancel = True
End Sub
But this macro prevents a user from saving indefinitely. How can I make it so the user has to check a checkbox in order to save?
Thanks!
Upvotes: 0
Views: 225
Reputation: 13386
try with
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = Not Worksheets(2).CheckBoxes(1).Value = 1
If Cancel Then MsgBox "Please accept the terms and conditions"
End Sub
where I assumed:
Upvotes: 2