Alexander Chervov
Alexander Chervov

Reputation: 944

How to save ALL Excel files every say minute / 10 seconds?

Question: How to save ALL Excel files every given time period - say every minute or every 10 seconds ?

Related: here How to save Excel file every say minute? a way to save given file is described. But if I have many files it is a problem to process like that.

Remark: In case if I need to save every minute - I can use Excel's autosave, but autosave is is in *.xlsb format which I have a problem reading by Python, also several files are created and it is not clear what file is saved in what moment. Also that would not work if I need to save every 10 seconds.

Upvotes: 1

Views: 3514

Answers (1)

Kresimir L.
Kresimir L.

Reputation: 2441

To save all open excel files every 10 seconds, you can use this code. You can assign it to shape and run it from one of the excel files.

Sub Save1()
Dim xWb As Workbook
Application.DisplayAlerts = False
For Each xWb In Application.Workbooks
        If Not xWb.ReadOnly And Windows(xWb.Name).Visible Then
            xWb.Save
        End If
    Next
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue("00:00:10"), "Save1"
End Sub

Upvotes: 4

Related Questions