Monday, March 4, 2013

Microsoft Outlook 'Are you sure?' prompt before sending Email

Often, I have been annoyed when Microsoft Outlook doesn't ask for confirmation before sending an email. Although I haven't faced any unwanted 'oops!-I-sent-the-mail' moments yet, the day is not far (for some of us, the day has already gone by ;) )

For this reason, I did a little search to see how I can add this functionality, and found this incredibly simple way:

1. Open outlook and press ALT+F11.
2. This will open a Microsoft Visual Basic for Applications window. On the left pane, expand the 'Project1' group, and go to 'Microsoft Outlook Objects' > 'ThisOutlookSession' (Double Click).

3. Add the following piece of code in the editor window that shows up:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        If MsgBox("Are you sure you want to send the email?", vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Send Email?") = vbNo Then
                Cancel = True
        End If
End Sub

4. Save the file (CTRL+S) and close.

Try sending a test mail to yourself. If you followed the steps well, the message box should show up the moment you click on 'send'!

Cool, isn't it?

Ref: Original post by Steve here: http://stevesgeekspeak.com/2010/01/howto-are-you-sure-prompt-in-outlook/
Note: I am not a VB expert, if you have questions related to the code. Have just shared this as a cool trick.