Run Macro at a specific time

  • Hi there,


    I have a macro that works as it should when I manually run it. I've tried using Application.Ontime to have it run at 3pm but so far that hasn't worked.



    Thanks

  • In the Workbook open event add this code, note I wouldn't use SaveAs as a macro name.


    Code
    1. Private Sub Workbook_Open( )
    2. Application.OnTime TimeValue("15:00:00"), "MyMacro"
    3. End Sub

    Do you want to save the active workbook or the one containing the code which may be different?


    Place this code in a Standard Module


    ThisWorkBook will save the workbook containing the code, ActiveWorkBook will save the currently active spreadsheet.

  • Try this, I've also noticed that your code does not restore Alerts which could cause problems.



  • Hi Roy,


    That code worked when I manually ran it....also worked with the time.value function.


    Last question....will the macro continue to work when I save a new copy of the worksheet. New month requires a new sheet.


    Thanks again for your help.