Solved

Dear Rgonzo please help making the code work in personal workbook to enforce it on any active workbook.

Posted on 2016-11-23
3
35 Views
Last Modified: 2016-11-23
I had this question after viewing VBA to automatically save the workbook every 2 minutes.

the code below works for single workbook, how this can be changed so that the auto save works on any activeworkbook instead of thisworkbook.?

thanks a million

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



Sub SaveMe()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True

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

Open in new window

0
Comment
Question by:excelismagic
3 Comments
 
LVL 19

Expert Comment

by:darbid73
ID: 41898974
I am not up with Excel VBA and their might be some way of creating a file with VBA code which Excel will read.

The only method I know in which you can have code running for the whole Excel Application and thus on all Workbooks is to make an Application Level addin with VSTO.

This is not easy for beginners, but you can always ask questions here.
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41898986
the code in the personal. workbook

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

Open in new window



Sub SaveMe()
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True

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

Open in new window

0
 
LVL 3

Author Closing Comment

by:excelismagic
ID: 41899016
thanks alot
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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