Excel VisualBasic Script

Sub Workbook_BeforeClose(Cancel As Boolean)
         If ThisWorkbook.Sheets("Sheet1").Range("A1").Value <> True Then
            Cancel = True
         End If
     End Sub