×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Microsoft: Office FAQ

Best of Excel

An AutoSave Add-In for Excel XP by Bowers74
Posted: 23 Aug 03 (Edited 25 Aug 03)

I must admit that I was a bit upset when I realized that Excel XP didn't have the AutoSave feature anymore, but I figured that even I could create a customizable AutoSave Add-in with the knowledge I have of VBA programming, instead of copying the one from Excel 2000.

Here is the code that I used at the beginning.  My AutoSave Add-in has now been so far customized that I can't post the code for it here, but the generic version works just as well.

The following code allows you to save all of the Open Workbooks and gives you the "option" of turning the AutoSave function off for the current session of Excel (By pressing "No").

The code is set to run every 5 minutes, but you can change that as well.

Insert the following code into the Workbook code module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime Now + TimeValue("00:05:00"), "AutoSave", , False
End Sub

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


Create a standard module and enter the following code:

Sub AutoSave()
Dim wb As Workbook
Dim msg As String
msg = "Do you want to save all of the open Workbooks now?" & vbCrLf & vbCrLf
msg = msg & "Selecting ""No"" disables the Auto Save function."
If MsgBox(msg, vbQuestion + vbYesNo, "Auto Save") = vbYes Then
    For Each wb In Application.Workbooks
        wb.Save
    Next wb
Application.OnTime Now + TimeValue("00:05:00"), "AutoSave"
End If
End Sub

Now, save the workbook as an Excel Add-In (.xla) and "install" it. Tools->Add-Ins....  You may have to browse for the file (depending on where you saved it).

As I stated before, you can customize you version of the Add-in as much as you like.  My versions (I use one at home and two different ones at work, depending on which PC I'm on) range from the code you see above to an Add-in with UserForms and Toolbar Button COntrols for different options.

I hope you find this helpful!

Back to Microsoft: Office FAQ Index
Back to Microsoft: Office Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close