Before sending a E-Mail...

  • Thread starter Thread starter Timur Zanagar
  • Start date Start date
T

Timur Zanagar

Hi folks,

If I click the "Sent" Button on a E-Mail I would like to receive a
Message Box which asks if I'm sure to sent this message.

Is this possible to realize? How should I do it?

Thank you very much in advance.
 
There is no such feature, but you can build it in with a little VBA code:

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
strMsg = "Do you want to send the message?"
MsgBox strMsg, vbYesNo, "Send It?"
If res = vbNo Then
Cancel = True
Item.Display
End
End If
End Sub

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue Mosher [MVP-Outlook], you wrote on Thu, 15 Sep 2005 14:50:38 -0400:
There is no such feature, but you can build it in with a little VBA code:

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
strMsg = "Do you want to send the message?"
MsgBox strMsg, vbYesNo, "Send It?"
If res = vbNo Then
Cancel = True
Item.Display
End
End If
End Sub

I just sampled this code in OL 2003 SP1. The message box appears indeed,
but when I click "No" the mail will be send anyway...?!?

Best Regards
Christian Goeller
 
Sorry, I was copying code from another snippet and forgot to change this statement

MsgBox strMsg, vbYesNo, "Send It?"


to

res = MsgBox(strMsg, vbYesNo, "Send It?")

so that you actually have a return value to work with.


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Christian Goeller said:
Sue Mosher [MVP-Outlook], you wrote on Thu, 15 Sep 2005 14:50:38 -0400:
There is no such feature, but you can build it in with a little VBA code:

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
strMsg = "Do you want to send the message?"
MsgBox strMsg, vbYesNo, "Send It?"
If res = vbNo Then
Cancel = True
Item.Display
End
End If
End Sub

I just sampled this code in OL 2003 SP1. The message box appears indeed,
but when I click "No" the mail will be send anyway...?!?

Best Regards
Christian Goeller
 
Sue Mosher [MVP-Outlook], you wrote on Thu, 15 Sep 2005 22:28:09 -0400:
Sorry, I was copying code from another snippet and forgot to change this statement

MsgBox strMsg, vbYesNo, "Send It?"

to

res = MsgBox(strMsg, vbYesNo, "Send It?")

so that you actually have a return value to work with.

This behavior occurs anyway as long as the "End" between "Item.Display"
and "End If" exists. Deleting "End" makes this code working perfect!

[...]
strMsg = "Do you want to send the message?"
MsgBox strMsg, vbYesNo, "Send It?"
If res = vbNo Then
Cancel = True
Item.Display
End
End If
End Sub
 
Sorry for the extra work. Cut and paste is an evil crutch.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Christian Goeller said:
Sue Mosher [MVP-Outlook], you wrote on Thu, 15 Sep 2005 22:28:09 -0400:
Sorry, I was copying code from another snippet and forgot to change this statement

MsgBox strMsg, vbYesNo, "Send It?"

to

res = MsgBox(strMsg, vbYesNo, "Send It?")

so that you actually have a return value to work with.

This behavior occurs anyway as long as the "End" between "Item.Display"
and "End If" exists. Deleting "End" makes this code working perfect!

[...]
strMsg = "Do you want to send the message?"
MsgBox strMsg, vbYesNo, "Send It?"
If res = vbNo Then
Cancel = True
Item.Display
End
End If
End Sub


--
Best Regards
Christian Goeller
Some misspellings, grammatical or linguistical mistakes found?
All corrections would be appreciated!
 
Timur Zanagar said:
If I click the "Sent" Button on a E-Mail I would like to receive a
Message Box which asks if I'm sure to sent this message.

Why would you click the Send button if you're not sure you wish to send it?
 
It is not about clicking on the Send button. What about pressing Ctrl +
Enter or Alt + S while you writing a important mail and you're not
finished yet.

I think at least one time everybody just did it.
 
Timur Zanagar said:
It is not about clicking on the Send button. What about pressing Ctrl
+ Enter or Alt + S while you writing a important mail and you're not
finished yet.

Those don't seem to be key combinations that are easily pressed by accident,
at least to me.
 
Brian Tillman, you wrote on Fri, 16 Sep 2005 11:42:55 -0400:
Those don't seem to be key combinations that are easily pressed by accident,
at least to me.

Well, if one has stubby fingers it happens faster than one thinks...

:-)
 
Back
Top