Do you ever get that thing where for some unknown reason you can’t turn off your head and get to sleep? Well, I do. Sometimes when I am there, I sit down at my computer and take care of something on my next actions list. Helps me feel like I have accomplished something, gets it off my mind and allows me to sleep. Sometimes I end up being awake for longer.
I have been known to check my e-mail in the middle of the night (probably not a good idea, really). Sometimes I will respond to e-mails that are waiting, never mind the hour. This in itself is not so bad, except that sometimes people notice that I have been sending e-mails in the middle of the night (note the timestamp on this posting). I have been setting the “send e-mail later” option, so as to not appear like a work-aholic. But I’m human, sometimes I don’t remember.
Enter VBA Scripting for Outlook. Say what you like about Outlook, and there’s plenty to say, but the geek in me is enjoying the scripting functionality lately. I wrote my own Outlook script (very little code theft here – except from the help file, which I feel is legit), which checks the time at which I am sending a message and if it’s between midnight and 8:00 am, viola…I get this pop-up: I bet you can figure out what happens when I push each button. Another effective “smart part of the brain” tricking the “dumb part of the brain” tool. Yayy.
(If you are also a geek and want to know how to do this, ask, and I will gladly share the code I wrote)
I have been known to check my e-mail in the middle of the night (probably not a good idea, really). Sometimes I will respond to e-mails that are waiting, never mind the hour. This in itself is not so bad, except that sometimes people notice that I have been sending e-mails in the middle of the night (note the timestamp on this posting). I have been setting the “send e-mail later” option, so as to not appear like a work-aholic. But I’m human, sometimes I don’t remember.
Enter VBA Scripting for Outlook. Say what you like about Outlook, and there’s plenty to say, but the geek in me is enjoying the scripting functionality lately. I wrote my own Outlook script (very little code theft here – except from the help file, which I feel is legit), which checks the time at which I am sending a message and if it’s between midnight and 8:00 am, viola…I get this pop-up: I bet you can figure out what happens when I push each button. Another effective “smart part of the brain” tricking the “dumb part of the brain” tool. Yayy.
(If you are also a geek and want to know how to do this, ask, and I will gladly share the code I wrote)
3 comments:
Why don't you just post the code on the site? I am kind of interested but to build something different for myself.
Jürgen
hollfelder.blogspot.com
Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
' this code checks to see if the message is being sent in the wee hours of the morning, and resets the outgoing time for 8:00 a.m.
Dim MyTime
MyTime = Time 'capture the current system time
Dim MyDate
MyDate = Date 'capture the current date
If MyTime < #8:00:00 AM# Then ' chek to see if it is between midnight and 8:00 am
'set up a mesage box so user can automatically change the time (default), or leave it alone.
Dim Msg, Style, Title, Response, MyString
Msg = "The current time is: " & MyTime & Chr(13) _
& "Would you like to set the delivery time for 8:00 am automatically?" & Chr(13) _
& "No will leave the send time as the current time." ' Define message.
Style = vbYesNoCancel + vbCritical + vbDefaultButton1 ' Define buttons.
Title = "Are you sending late-night e-mails?" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
Item.DeferredDeliveryTime = MyDate + #8:00:00 AM# ' change the deffered delivery date/time.
ElseIf Response = vbCancel Then ' User Chose No.
Cancel = True
Item.Display
End If
' if you want to delay all e-mails that aren't late night by 5 mins or so, put that code here
End If
' This code checks for a blank sbject line, before sending
Dim strMessage As String
Dim lngRes As Long
If Item.Subject = "" Then
Cancel = True
strMessage = "Please fill in the subject before sending."
MsgBox strMessage, _
vbExclamation + vbSystemModal, "Missing Subject"
Item.Display
End If
End Sub
Thanks alot.
Post a Comment