Bestätigung beim Schliessen der Form

Hallo.
Ich würde gern eine MsgBox aufrufen wenn das Programm über das X beendet wird. Wie mache ich das ?

mfg Joe

Hi Joe,

Option Explicit

Private Sub Form\_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 If MsgBox("Sind sie sicher?", vbOKCancel, "Sicherheitsabftage") = vbCancel Then
 Cancel = True
 End If
End Sub

Gruß, Rainer