title: Using BeforeClose and ActiveX CheckBox values in Excel 2010
body: <p>I am trying to prevent an excel workbook from closing based-on the state of a checkbox.</p>
  
  <p>My sample code that is placed in 'ThisWorkbook' :</p>
  
  <pre><code>Private Sub Workbook_BeforeClose(Cancel As Boolean)
      If CheckBox0.Value = "FALSE" Then
      b = MsgBox("Are you sure that you want to submit?", vbYesNo)
      End If
      If b = vbNo Then Cancel = True
  
  End Sub
  </code></pre>
  
  <p>At the moment, I am getting a run-time error 424 , object required and the debug points at the If <code>CheckBox0.Value.....</code> line.</p>
  
  <p>I am not sure what I am doing wrong and I'm not a regular VBA user.</p>
  
  <p>Help, please.</p>