Search code examples
excelvba

How to save an Excel file every, say one minute?


Are there some macros which can do it?


Solution

  • Please put this code in ThisWorkbook module. you can access this module by pressing double click on ThisWorkbook module inside VBA project.

    Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:01:00"), "Save1"
    End Sub
    

    enter image description here

    then put this code in standard module. To insert standard module, right click on VBA project==>Insert==>Module. then paste code in newly created module.

    enter image description here

    Sub Save1()
    Application.DisplayAlerts = False
    ThisWorkbook.Save
    Application.DisplayAlerts = True
    
    Application.OnTime Now + TimeValue("00:01:00"), "Save1"
    End Sub
    

    Now when you open your workbook, it will automatically save every minute. You need to reopen Workbook in order to trigger Workboook_Open event.