Guys
I developed a spreadsheet that when the file is opened it sends an e-mail after 1 minute and then it auto close the workbook.
There are certain days that I need to send the report. So I created a task scheduled on Windows to send the report every
Wednesday, Friday, Saturday at 12:00:30 and on Sundays at 07:15:30.
Sometimes I will need to use the file for update some information inside or maybe manipulate some data as well.
I need to find a way to open this file and edit it without I send every minute an email with the report.
My Idea is to develop a routine that can verify if the Time and Day are different from what I have on Task Scheduler so the event Workbook_Open() will not send any email.
Below my general ideia. I need your assistance guys on how to make it works properly.
I developed a spreadsheet that when the file is opened it sends an e-mail after 1 minute and then it auto close the workbook.
Code:
Application.OnTime Now + TimeValue("00:01:00"), "SendReport"
There are certain days that I need to send the report. So I created a task scheduled on Windows to send the report every
Wednesday, Friday, Saturday at 12:00:30 and on Sundays at 07:15:30.
Sometimes I will need to use the file for update some information inside or maybe manipulate some data as well.
I need to find a way to open this file and edit it without I send every minute an email with the report.
My Idea is to develop a routine that can verify if the Time and Day are different from what I have on Task Scheduler so the event Workbook_Open() will not send any email.
Below my general ideia. I need your assistance guys on how to make it works properly.
Code:
Private Sub Workbook_Open()
If TriggerVerifier Then
Application.OnTime Now + TimeValue("00:01:00"), "SendReport"
Else: End If
End Sub
Code:
Function TriggerVerifier() As Boolean
TriggerVerifier = True
Select Case Weekday(Date, 1)
Case 1
If Time < TimeValue("07:15:30") Or Time > TimeValue("09:46:45") Then
TriggerVerifier = False
End If
Case 4, 6, 7
If Time < TimeValue("12:00:30") Or Time > TimeValue("12:01:45") Then
TriggerVerifier = False
End If
Case 2, 3, 5
TriggerVerifier = False
End Select
End Function