Save changes automatically, specify this as a parameter of the Close method
Sub CloseWorkbook()
Dim myWorkbook1 As Workbook
Set myWorkbook1 = Workbooks.Open(FileName:="C:\Data\SalesData1.xlsx")
Range("A1").Value = Format(Date, "ddd mmm dd, yyyy")
Range("A1").EntireColumn.AutoFit
myWorkbook1.Close SaveChanges:=True
End Sub
Related examples in the same category