I have a macro to prevent users from saving a file leaving mandatory fields blank.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
Cellcontents = Sheets("Form").Range("H12").Value<o
></o
>
If Cellcontents = "" Then<o
></o
>
Cancel = True<o
></o
>
MsgBox "Company Name is empty . Unable to Save!", vbOKOnly, "Check Cells"<o
></o
>
Exit Sub<o
></o
>
End If<o
></o
>
End Sub<o
></o
>
The problem is that I cannot save the file with the blank form because the macro prevents me from doing it.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com




Cellcontents = Sheets("Form").Range("H12").Value<o


If Cellcontents = "" Then<o


Cancel = True<o


MsgBox "Company Name is empty . Unable to Save!", vbOKOnly, "Check Cells"<o


Exit Sub<o


End If<o


End Sub<o


The problem is that I cannot save the file with the blank form because the macro prevents me from doing it.