Share via

Open outlook email from word using visual basic button

Anonymous
2016-02-10T14:27:45+00:00

My question is hopefully a simple one for you. I created a form that opens in MS Word 2013. On that form I have a command button. I would like to have that command button open a blank compose email from Outlook 2013 when it is clicked. I think this code would be simple, but I think I'm missing something very simple. Please help! Thanks in advance!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2016-02-17T14:16:03+00:00

    Thank you so much for the help!!! This code worked perfectly! Again, can't thank you enough for your help!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-02-11T11:49:36+00:00

    Try this; I've included some notes to help you adapt it to your needs.

    Sub EMail_Reports()

        'For the email side

        Dim OutApp As Object

        Dim OutMail As Object

        Set OutApp = CreateObject("Outlook.Application")

                Set OutMail = OutApp.CreateItem(0)

                With OutMail

                    .Subject = "This is my blank email's subject line"

                    .Body = "This is an example of" & _

                            Chr(13) & _

                            "building a multi-line email where I " & _

                            Chr(13) & _

                            "want to control where the line breaks are." & _

                            Chr(13) & _

                            Chr(13) & _

                            "Thank you," & _

                            Chr(13) & _

                            "My name goes here"

                'If you knew the address you were sending it to in advance, you could add it here

                '    .To = CurrUserID

                'optional: set read receipt

                '  .ReadReceiptRequested = True

                'optional: set delivery receipt

                '  .OriginatorDeliveryReportRequested = True

                End With

            'If you wanted to just send the email without editing or reviewing:

            'OutMail.Send

            'If you just want it to remain open as a draft so you can edit or save it:

            OutMail.Display

            Set OutMail = Nothing

        Set OutApp = Nothing

    End Sub

    Note: This worked for me in Office2010, I don't have/use 2013, so caveat emptor.

    Note: I recall from a previous project that MS introduced a new limit in o2010 on the number of draft emails you can create and have open at the same time, I think I ended up limiting ours to 20 at a time, at which time the user could review and send (or save/close) them, then create the next 20.

    The code above just creates a "blank" email, per your original post. If you are trying to load data from the form into the email, you'd want to loop the text fields you created and uniquely named to pull the data and push it into this email. If you are trying to attach a copy of the Word form, that would be different (and probably easier, although I haven't done it- I'd look for the VBA equivalent of 'save and send').

    Was this answer helpful?

    0 comments No comments