Automatically Save As Date And Time Every x Minutes

  • Hi,


    I've got what I hope is a relatively straightforward problem. I want to write a piece of code that will automatically do a SaveAs on the workbook I'm using, say every hour, and add the current system date and time to the filename every time.


    Is this possible?!


    Any help would be greatly appreciated.


    Thank you.

  • Re: Auto Saveas Including Date And Time In Filename


    In a standard Public Module, copy paste;

    Into the ThisWorkbook Module paste;

    Code
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Application.OnTime dTime, "MySaveAs", , False
    End Sub
    
    
    Private Sub Workbook_Open()
        dTime = Time + TimeValue("01:00:00")
        Application.OnTime dTime, "MySaveAs"
    End Sub
  • Re: Automatically Save As Date And Time Every x Minutes


    Sorry to drag up an old thread here but can someone please explain to me how to access the 'public module' and the 'ThisWorkbook module'
    I am trying to do something very similar but am struggling somewhat - I am attempting to automatically save a spreadsheet without prompt every 15 minutes with a filename of the current date and time.
    If there is anybody out there who can help I would greatly appreciate it.
    Many Thanks in advance
    Ryan

  • Re: Automatically Save As Date And Time Every x Minutes


    I have now got this working correctly with the right filename and frequency - however I am struggling with the file itself all I get saved is a file with no .xlsm just a un-useable file.
    Please help me

  • Re: Automatically Save As Date And Time Every x Minutes


    Please do not post new questions in old threads - create a new thread with your question and if you feel this thread is of relevance then simply reference the thread by adding a link in your post. This thread has been closed. You will need to create a new post.

    Regards
    [SIZE=3]Anthony
    [/SIZE]&WCF_AMPERSAND[SIZE=3]
    [/SIZE]&WCF_AMPERSAND&WCF_AMPERSAND&WCF_AMPERSAND[SIZE=2]You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.[/SIZE]




Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!