Problem with ontime.application

  • Hello.

    I wrote this code in the Code of Sheet1

    Sub Macro1()
    ActiveSheet.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:="C:\test\upload\sample.pdf", _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, _
    End Sub

    I would like to run this every 5 minutes so I wrote this code and put it in ThisWorkbook

    Sub Schedulemacro()
            Application.OnTime Now + TimeValue("00:05:00"), "Blad27.Macro1"
    End Sub

    The problem is that this ran once but the next 5 minutes the code won't run.

    What did I wrong ? What can I do to solve this ?


  • Re: Problem with ontime.application

    Aftr the macro1 has finished, you want to do it again right? So just add

    call Schedulemacro

    before End Sub inside Macro1

Participate now!

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