Log in

View Full Version : myOlApp_ItemSend



ALINA
01-25-2007, 06:59 AM
hello
before sending an e-mail i want a form to be appear on the new message form not on outlook

Public WithEvents myOlApp As Outlook.Application
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
End Sub

Public Sub Initialize_handler()
Set myOlApp = CreateObject("Outlook.Application")
End Sub
Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If
End Sub

this is give me a message on outlook not on the sending message

Potemkin
02-15-2007, 08:54 AM
Dear Alina,

Try the following code:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim intResponse As Integer

If Item.Class = olMail Then

If Item.Sent = False Then
intResponse = MsgBox("Are you sure you want to send " & _
item.Subject & "?", _
vbYesNo + vbExclamation, "Subject Check")

If intResponse = vbNo Then
Cancel = True
End If

End If 'Item.Sent = False
End If 'Item.Class = olMail
End Sub