title: Prompt before close
body: <p>Before the user closes the form I want to prompt with a confirmation box.</p>
  
  <p>I am not sure how to do this.
  I have tried the code below and it prompts the user but upon clicking no it closes the form anyway:</p>
  
  <pre><code>Private Sub Form_Close()
      If MsgBox("Test", vbYesNo + vbExclamation, "Confirm close") = vbYes Then
      Else
          Cancel = True
      End If
  End Sub
  </code></pre>