When creating mail via VBA, Outlook interface not accessible RRS feed

  • Question

  • All

    I use next function to send mails over Outlook 2010.  As the content of the mail must be verified each time (due to company procedures) the mail is displayed on the screen and the user must manually press on the Send-button in Outlook.

    The issue: once the generated mail is displayed on the screen, it seems to be impossible to active the Outlook main program to open another mail or to lookup information. All of Outlook seems to be locked as long the generated mail is not send.

    Is there a solution for this issue?  Note: I aml not allowed to send the mail over a CDO-object as the mail must be saved in Outlook Sent Items.



    Public Sub SendExchange(strTo As String, strCC As String, strBCC As String, strSubject As String, strBody As String)
    Dim OutMail As Object
    Dim OutApp As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    With OutMail
        '.BodyFormat = olFormat
        .To = strTo
        .cc = strCC
        .BCC = strBCC
        .Subject = strSubject
        .HTMLBody = strBody
     End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
    End Sub

    • Moved by Steve Fan Thursday, November 16, 2017 8:02 AM relocate
    Wednesday, November 15, 2017 7:12 AM


All replies

  • Hi,

    Welcome to the Microsoft Office for IT Professionals Outlook forum. This forum is for general questions and feedback related to Microsoft Outlook application. Since your question is more related to coding, I'll move it to the dedicated Outlook for Developers forum:

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Steve Fan

    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, November 16, 2017 8:01 AM
  • I could not reproduce this issue with the above code.  Using Outlook 2013 a modeless Inspector window is opened by the MailItem Display method.  The running instance of Outlook can be opened from the icon in the taskbar notification area and is responsive while the Inspector window is open and before the new mail is sent.  By default, the MailItem Display method does not create a modal window.

    • Edited by RLWA32 Thursday, November 16, 2017 9:28 AM
    Thursday, November 16, 2017 9:26 AM
  • Are you sure you are not calling Display(true) to display the message modally?

    Can you change the code above to explicitly call Display(false0?

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, November 16, 2017 4:08 PM
  • This topic is no longer applicable
    • Marked as answer by ino_mart Monday, February 12, 2018 10:02 AM
    Monday, February 12, 2018 10:02 AM