Option Explicit
Public boolProject As Boolean
Public boolOK_Clicked As Boolean
Public strSaveType As String
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Workbook_BeforeSave(True, False)
If boolProject = False Then Cancel = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
On Error GoTo ErrorHandler
frmOnSave.Show
If ThisWorkbook.strSaveType = "NoSave" Then
boolProject = True
Cancel = True
Exit Sub
ElseIf ThisWorkbook.strSaveType = "Edit" Then
boolProject = True
ElseIf ThisWorkbook.strSaveType = "Final" Then
If FinalSaveChecks = False Then
boolProject = False
Cancel = True
Exit Sub
Else
Call modOctetPlateFileCreation.CreateSTDsList
boolProject = True
Cancel = False
End If
ElseIf ThisWorkbook.strSaveType = "" Then
boolProject = False
Cancel = True
Exit Sub
End If
Exit Sub
ErrorHandler:
MsgBox "Error occurred in " & ActiveWorkbook.Name & ": Workbook_BeforeSave." & vbCrLf _
& vbCrLf & "Error #" & Err.Number & " - " & Err.Description
End Sub