form_unload problem

  • Thread starter Thread starter Benny5788
  • Start date Start date
B

Benny5788

Hi, I have never done any macros in vba for excel. I have however don
some vb, but it was a long time ago. If i remember well Private Su
Form_Unload(Cancel As Integer) was everything u wanted to do before
closed ur form. Heres the beginning of the code i was working on.
Nothing happens on the form unload, i tryed putting a messagebox there
but nothing happened. Is there something u gotta do differently in vb
then in vb

Thanks
Ben

Option Explicit

Private Sub Form_Load()

End Sub

Private Sub Form_Unload(Cancel As Integer)

If ThisWorkbook.Saved = False Then
ThisWorkbook.Save
End If

ThisWorkbook.Close

End Su
 
As far as I know there is no Unload event for a userform in VBA.

There are Terminate, Deactivate and QueryClose events
 
Back
Top