automatically saving word doc versions every 5mins

Hi - I'm new to VBA and have no idea how to go about this.

I can get as far as writing a macro that creates a Version of a specific Word document on command - but I also want it to automatically do this when the document is opened and then every 5 minutes until it is closed.

Thanks for any help!


Answer this question

automatically saving word doc versions every 5mins

  • Goran _

    To change the auto-save time interval to 5 minutes, do this:

    Application.Options.SaveInterval = 5



  • VeryNoisy

    does this save it as a separate doc I want to save separate copies of the document every 5 minutes (I know it sounds strange, but there's a good reason!). I thought saving versions would be better as it woud take up less space.

  • madhu_v

    Hello,

    Use the Application.OnTime method to schedule when your code should run. Here's the example from the help, runs Macro1 in 15 seconds time.

    Application.OnTime When:=Now + TimeValue("00:00:15"), _
    Name:="Project1.Module1.Macro1"

    if you want to continuely run your macro every 5 minutes you call the macro containing the OnTime from the OnTime method. I haven't explained that well, it's been a long day, here is an example.

    Public Sub SaveBackupEveryFiveMinutes()

    'save your document backup

    Application.OnTime When:=Now + TimeValue("00:05:00"), _
    Name:="Project1.Module1.SaveBackupEveryFiveMinutes"

    End Sub



  • trogdor2323

    Try to run this function every five minutes.


    Sub SaveAsOther()
    Dim basename As String
    Dim filename As String

    basename = "NewDocument"
    filename = basename & "-" & Format(Now(), "yyyymmdd_hhmm") & ".doc"

    Application.ActiveDocument.SaveAs filename

    End Sub



  • automatically saving word doc versions every 5mins