+ Reply to Thread
Results 1 to 7 of 7

Autosave after idle error message

  1. #1
    Registered User
    Join Date
    04-17-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Autosave after idle error message

    I am attempting to have my file autosave after it is idle for a set amount of time, but not close. The function I am using is a common one found when searching on the web, but the problem is that after the idled save and someone attempts to re-activate the sheet by entering data or changing sheets I will receive the an "Run-Time error '1004':" message which says "Method 'OnTime' of object'_Application' failed" and it points me to line

    Application.OnTime SchedSave, "SaveWork", , False

    the codes that I am using are as follows:

    in ThisWorkBook:

    Please Login or Register  to view this content.
    and in module1:

    Please Login or Register  to view this content.
    Last edited by ron9595; 04-20-2012 at 01:53 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Autosave after idle error message

    You're trying to unschedule an event that has already occurred. Maybe ...

    Please Login or Register  to view this content.
    That's a very dangerous routine. If someone hoses the workbook and then goes to get a cup of coffee, their mistake will get immortalized.
    Last edited by shg; 04-17-2012 at 02:00 PM. Reason: changed implementation
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-17-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Autosave after idle error message

    update.... autosave works perfectly, but it only runs one time. Can you modify macro to reset and run again after new activity? Like I said this file has been known to be open for days, so I need this to be repeatable. .
    Last edited by ron9595; 04-17-2012 at 06:25 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Autosave after idle error message

    Try changing bRun to Public and set it False in the Workbook_SheetChange event

  5. #5
    Registered User
    Join Date
    04-17-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Autosave after idle error message

    Still having problems. I can get autosave to work after a new entry, but it saves after "every" entry now. If someone enters two pieces of data 5 seconds apart, then 10 minutes from now the program saves twice 5 seconds apart. Could be an issue if someone enters 20 pieces of data, 10 minutes later it would be on a save loop until it reached 20 times!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Autosave after idle error message

    What's all the code now?

  7. #7
    Registered User
    Join Date
    04-17-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Autosave after idle error message

    I think I might have it now, or I am probably more correct in saying that I bypassed the problem. After numerous different versions of the code you supplied, I deleted them all and started over and inserted "On Error Resume Next" right after the "If tSave <> 0 Then" line, as this is the line that would supply an error whenever executing your macro. It might be a bandaid, but it works this way!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1