Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA to automatically save the workbook every 2 minutes

Posted on 2016-11-23
3
Medium Priority
?
134 Views
Last Modified: 2016-11-23
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
Comment
Question by:excelismagic
3 Comments
 
LVL 53

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41898805
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
 
LVL 34

Expert Comment

by:Rob Henson
ID: 41898897
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
 
LVL 3

Author Closing Comment

by:excelismagic
ID: 41898921
Thanks so much.

posting another similar question. on how to make this code work on any active workbook.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question