I have set up a windows scheduler even to open a specific file every friday at 9.30am.
I now would like to set up a workbook_open event which generates an email when the scheduler opens the file.
I dont want the email to generate every time the work book is open.
Does anyone have any sample code for me? I am interested in determining time workbook opened and day, and I am also unsure of the code required to send an email.
Any assistance would be much appreciated:
Got this far.
I want the email to be sent only if the workbook is opened between the times 9:25 and 9:35am . I have entered these times into the worksheet as ranges in cells: LTime (9:25) and UTime (9:35) . Formatted them as times.
Generation of email works. Only remaining issue is that the statement:
If LTime > dTime > UTime keeps on evaluating to false.
Does anyone know why this keeps on evaluating to false.
Dim dTime As Date
dTime = TimeValue(Now)
Dim LTime As Date
Dim UTime As Date
LTime = wsConsole.Range("LTime")
UTime = wsConsole.Range("UTime")
LTime = TimeValue(LTime)
UTime = TimeValue(UTime)
If LTime > dTime > UTime Then
Else: Call Open_Book