Private Sub Form_UnLoad(Cancel As Integer) On Error Resume Next If Cancel = False Then código..... End If End Sub