Open new Outlook message with email address and subject line complete but body blank

Posted on 2005-04-22
Last Modified: 2012-06-27
Basically I just need to know how to make the new Outlook message open. I know how to do the rest.

Here is the code I currently have:

Dim objOutlook As New Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strLtrContent As String
strLtrContent = "Dear " & FIRST_NAME.Value & " " & _
                 LAST_NAME.Value & ":" & vbCrLf & vbCrLf & _
                 "Your SITE account password is: " & Password.Value & _
                 vbCrLf & vbCrLf & "Please wait 24 hours before attempting to change your password." & _
                 vbCrLf & vbCrLf & "If you have questions or issues with MySite, please contact:" & _
                 vbCrLf & "John Doe (" & vbCrLf & _
                 "Jack Doe( or" & vbCrLf & _
                 "Jane Doe (" & vbCrLf

Set objEmail = objOutlook.CreateItem(olMailItem)
objEmail.Recipients.Add Email.Value
objEmail.Subject = "Your Account"
objEmail.Body = strLtrContent

So instead of sending this email, I just want it to fill in the recipient info (objEmail.Recipients.Add Email.Value) and the subject line (objEmail.Subject = "Your Account" and then open the message so I can write a personalized email. How do I modify this code to achieve this?
Question by:cjones_mcse
    LVL 32

    Expert Comment

    What version of Outlook do you have? Some of the later versions don't quite work properly. I have 2003, and ended up copying the address to the clipboard so that when the message displayed, all I have to do is paste it in.

    Tacky, but works for me.
    LVL 10

    Accepted Solution

    Hi, cjones_mcse.

    I haven't tested your code above, but if it populates the body of an email and sends it, and you just want a new email to open so you can populate the body yourself and send it manually,
    just REM out the last two lines of code:

         'objEmail.Body = strLtrContent

    However, it is Friday evening, so maybe I entirely misunderstood your question.  In any event, here's the code I use.  The main thing I've noticed when manipulating Outlook 2000 is that it ignores all instances of "vbNewLine", so I have to do a replace with "<br>":

        Dim outApp As Outlook.Application
        Dim olMail As MailItem
        Set outApp = New Outlook.Application
        Set olMail = outApp.CreateItem(olMailItem)

        Dim strTemplate, strSubject As String
        Dim strTxtAllConvert As String
        strTxtAllConvert = Replace(txtAll.Text, vbNewLine, "<br>")
        strTemplate = strTxtAllConvert

         'required to control the HTML body font:
        Dim strFontControlBody As String
        strFontControlBody = "<font face = MS Sans Serif size=3>" & strTemplate & "</font>"
        strSubject = "%& MDN: " & strMDN & "*" & strCenter & "**" & strRep & "***" & strProblemType

        With olMail
            .To = ""
            .Subject = strSubject
             .HTMLBody = strFontControlBody
            'Line above invokes HTML control of email font; so line below no longer required
            '.Body = strTemplate
            '.Attachments.Add _
            'source:="C:\Documents and Settings\edwardiii\Images\VZW.jpg"
        End With

    LVL 4

    Expert Comment

    If outlook is your default mail client then I think you can do it by simply 'shell'ing the  e.g.

    Add the following declaration
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    then use

    call ShellExecute(hwnd, "Open", "", "", app.path, 1)

    It should open a new email message with the default client and fill in the subject and to fields, obviously this is only useful to yourself if the default client is Outlook


    LVL 10

    Author Comment

    Awesome Ed!  Thanks a ton!
    LVL 10

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now