What is the syntax to close a workbook?

ActiveWorkbook.Close SaveChanges:=<true/false>
#true if want to save changes before closing
#false if disregard changes before closing
#example
Private Sub btnExit_Click()
   ActiveWorkbook.Close SaveChanges:=True 
End Sub

 

 

Advertisements

What is the syntax to close a user form?

‘method 1
Unload Me

‘method 2
Unload <user form name>

‘method 3
<user form name>.Hide

 

What is the difference between Unload and Hide?
Unload clears all data stored in the userform, kind of like restarting a computer. Hide keeps the data but just makes the form go away, like sleeping your computer.