Simple Excel Autosave Macro

Add the following code under ThisWorkbook module in your workbook:

Private Seconds As Integer

Private Sub Workbook_Open()
    Seconds = 300 ‘ 5 minutes. Adjust as you wish
End Sub

Sub ScheduleSaving()
    Application.OnTime Now + Seconds / 24 / 3600, “ThisWorkbook.SaveMyWorkbook”, Now + 1.5 * Seconds / 24 / 3600
End Sub

Sub SaveMyWorkbook()
    Debug.Print “Saving workbook…”
    Debug.Print “Saved workbook.”
End Sub

One Response to “Simple Excel Autosave Macro”

  1. Justin says:

    FYI – if you just do a basic copypasta from this, it will not work, you have to replace the quotation marks with normal quotation marks due to the difference in formatting.

Leave a Reply