• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

VBA to automatically save the workbook every 2 minutes

I need help with VBA code, where when the workbook is open it is automatically saved every 2 minutes.

how can i accomplish this?  

thanks for your help.
0
excelismagic
Asked:
excelismagic
1 Solution
 
Rgonzo1971Commented:
HI,

pls try in the workbook module
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:02:00"), "SaveMe"
End Sub

Open in new window

in a normal module
Sub SaveMe()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue("00:02:00"), "SaveMe"
End Sub

Open in new window

Regards
0
 
Rob HensonFinance AnalystCommented:
MS did away with the AutoSave feature a few versions ago, a mistake in my opinion.

There is now the AutoRecover option instead. This creates a backup of the file at the timed interval but doesn't actually overwrite the original file. If Excel then crashes or is brutally closed via Task Manager, when re-opening recent AutoRecovered files will be shown with options for opening them.
0
 
excelismagicAuthor Commented:
Thanks so much.

posting another similar question. on how to make this code work on any active workbook.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now