I want to make a quick check on the file being used before the user saves it. If the result of the If statment is True I don't want the file to be saved. How do I do this?
Thanks
Code:
Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.Name = "Q0 Template.xls" And Worksheets.Count > 7 Then
MsgBox ("You are attempting to save this file as the Template workbook." & vbCr & vbCr & _
"If this file contains data then save the file with another name," & vbCr & _
"otherwise close this file without saving."), vbExclamation
Exit Sub
Else
End If
End Sub