Hi guys,
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:
*update*
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.
Sub Workbook_Open()
Dim dTime As Date
Call Definitions
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
Call Send_Email_Using_Keys
Else: Call Open_Book
End If
End Sub
Thanks


Reply With Quote
