I am trying to run a macro each day at 9am. I am trying to use the OnTime application and have tested the macro to launch at a specific time but it does not work automatically. I have to manually run the macro to get the message box to pop-up. Any advice?
Sub FinancialAlert()
Application.OnTime TimeValue("15:33:00"), "Summary of Covered Companies"
Dim i As Long
i = 5
While Workbooks("Montreal Issuers.xlsm").Sheets("Summary of Covered Companies").Cells(i, 5) <> ""
With Workbooks("Montreal Issuers.xlsm")
If .Sheets("Summary of Covered Companies").Cells(i, 5).Value = 1 Then
MsgBox Workbooks("Montreal Issuers.xlsm").Sheets("Summary of Covered Companies").Cells(i, 3).Value & " is issuing their next financial statement tomorrow (" & _
Format(Workbooks("Montreal Issuers.xlsm").Sheets("Summary of Covered Companies").Cells(i, 4).Value, "[$-409]mmmm d, yyyy;@") & ")."
End If
If .Sheets("Summary of Covered Companies").Cells(i, 5).Value = 0 Then
MsgBox Workbooks("Montreal Issuers.xlsm").Sheets("Summary of Covered Companies").Cells(i, 3).Value & " is issuing their next financial statement today (" & _
Format(Workbooks("Montreal Issuers.xlsm").Sheets("Summary of Covered Companies").Cells(i, 4).Value, "[$-409]mmmm d, yyyy;@") & ")."
End If
End With
i = i + 1
Wend
End Sub