R Quade
R Quade

Reputation: 49

Autosave ALL Excel Files Every X Minutes

I know there is a way to save one file every x minutes by defining it in the file's modules or Worksheets. Here is a code I found:

Sub SaveThis()
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue("00:05:00"), "SaveThis"
End Sub

Question: Is it possible to have this run on any active file? I was trying to use Personal Macro Workbook, but I cannot figure out how to have it automatically run on the open file.

Thanks in advance.

Upvotes: 1

Views: 1470

Answers (1)

Absinthe
Absinthe

Reputation: 3391

Just loop through the workbooks collection:

Application.DisplayAlerts = False
For w = 1 to Workbooks.Count
     Workbooks(w).Save
Next w
Application.DisplayAlerts = True

Upvotes: 1

Related Questions