In this video, we will create a VBA macro that will save any open excel workbook to a default location with current date and time
Пікірлер: 2
@atefbo63635 ай бұрын
Thank you for your effort. I have question : what if i want to save + close multiple open excel files without changing the name ?
@theDataCorner5 ай бұрын
Thank you Atef, I appreciate it. Please use below code and let me know if it works for your task, it will save and close all open excel files. If you want me to make a small video explaining the code, let me know as well. Sub SaveAndCloseWorkbooks() Dim wb As Workbook ' Disable display alerts to suppress warnings Application.DisplayAlerts = False ' Loop through all open workbooks For Each wb In Workbooks ' Save changes if the workbook has been modified If wb.Saved = False Then wb.Save End If Next wb ' Close all open workbooks without warnings Workbooks.Close ' Enable display alerts again Application.DisplayAlerts = True End Sub