Confirm Each Recipient in a New Outlook Mail Before it is Sent

G

Gruver

In Microsoft Outlook (2007) is there any way you can write code that will
present you with a message box asking you to confirm each of the recipients
in an e-mail after yopu click 'Send' and immediately before the e-mail is
dispatched to the server?

After I click on 'Send' I'd like to see a message box with something like
"Please confirm that you wish to send this e-mail to A and B and C (and that
you wish to copy X and Y and Z)". Ideally I'd like to see the names as they
appear in my address book i.e. 'John Doe' rather than
'(e-mail address removed)'.

The e-mail would only be sent after you confirmed the recipients by clicking
on the 'OK' button on the dialog box. If you clicked 'Cancel' you would be
returned to the e-mail and could then either add or remove recipients. The
message box would also prevent accidental sending (by mistakenly clicking the
'Send' button or by typing 'Alt+S').

I'm sure many would find the message box annoying but I would find it very
helpful. I know you can double-check the names in the address fields before
clicking Send (which I always do anyway) but there are times when a double
check would be very useful.

I've looked for some code to achieve this (I'm not entirely familiar with VB
in Outlook) and came across the code below which I think is trying to do
something very similar to what I want but I can't get it to work.

If anyone can point me in the right direction I'd be very appreciative.

http://blogs.technet.com/kclemson/archive/2004/01/02/47268.aspx

How about a simple confirmation message asking if you really want to send
it? You can do this by pasting the code below into your ThisOutlookSession
VBA module:

Option Explicit
Dim WithEvents objInspectors As Inspectors
Dim WithEvents objMyNewMail As MailItem

Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
End Sub

Private Sub Application_Quit()
Set objInspectors = Nothing
Set objMyNewMail = Nothing
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class <> olMail Then Exit Sub
Set objMyNewMail = Inspector.CurrentItem
End Sub

Private Sub objMyNewMail_Send(Cancel As Boolean)
If MsgBox("Are you sure you want to send this message?", vbYesNo +
vbQuestion _
, "SEND CONFIRMATION") = vbNo Then
Cancel = True
End If
End Sub
 
K

Ken Slovak - [MVP - Outlook]

Eric's code looks OK, although by the time Application_Quit() fires any
Outlook objects are out of scope and can't be released in that event. I'd
just comment out that event handler entirely.

The code should work if you've enabled macros, what problem are you having
with it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top