|
-
Aug 22nd, 2012, 07:39 AM
#1
Thread Starter
Junior Member
[RESOLVED] Autogeneration of an email dependant on time criteria
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
Last edited by InderpalHothi; Aug 22nd, 2012 at 10:31 AM.
Reason: update
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|