Consulting

Results 1 to 2 of 2

Thread: myOlApp_ItemSend

  1. #1
    VBAX Newbie
    Joined
    Jan 2007
    Posts
    1
    Location

    myOlApp_ItemSend

    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

  2. #2
    Dear Alina,

    Try the following code:
    [vba]
    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


    [/vba]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •