close work book via macro

  • Thread starter Thread starter Sunil Patel
  • Start date Start date
S

Sunil Patel

How do you suppress warnings when closing workbook
via macro i.e. do you want to save changes yes or no

thanks in anticipation
 
Application.DisplayAlerts = False
' your code
Application.DisplayAlerts = True

Regards

Trevor
 
Hi Sunil

ActiveWorkbook.Close SaveChanges:=False

or

ActiveWorkbook.Close SaveChanges:=true
 
Workbooks("Name").Close SaveChanges:=True
or
Workbooks("Name").Close SaveChanges:=False


or

Application.DisplayAlerts = False
Workbooks("Name").Close
Application.DisplayAlerts = Tru
 
Back
Top