Hello,
I have an Excel file that runs untouched 24/7, and I want it to execute a macro every day at 2:47PM. However, the macro is also automatically executed when the date changes at midnight and I don't understand why or how to fix it. I have the code pasted below.
Public cRunWhen As Date
Private Sub Workbook_Open()
cRunWhen = Sheets("E-mailTab").Range("A21").Text ' (A21 ="2:47PM")
Application.OnTime TimeValue(cRunWhen), "CDO_Mail_Small_Text"
End Sub
I have an Excel file that runs untouched 24/7, and I want it to execute a macro every day at 2:47PM. However, the macro is also automatically executed when the date changes at midnight and I don't understand why or how to fix it. I have the code pasted below.
Public cRunWhen As Date
Private Sub Workbook_Open()
cRunWhen = Sheets("E-mailTab").Range("A21").Text ' (A21 ="2:47PM")
Application.OnTime TimeValue(cRunWhen), "CDO_Mail_Small_Text"
End Sub