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 workbook?

Workbooks("<workbook name>").Close saveChanges:=<true or false>
'example
Workbooks("example.xlsm").Close saveChanges:=true