VBA in Word to send out body of Word doc in Outlook

I have created a document in Word with a "Submit" button that uses VBA to send the document via Outlook as an attachment.  My preference would be to send the information included in the Word document in the body of the email message vs. an attachment.

Cut and Paste from developer in Word:

Private Sub Submit_Click()
Dim OL          As Object
Dim EmailItem   As Object
Dim Doc         As Document

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save

With EmailItem
    .Subject = "Quote Request"
    .To = "wmimms@metalworkinggroup.com"
    .CC = "wnmimms@gmail.com"
    .Importance = olImportanceNormal
    .Attachments.Add Doc.FullName
    .Display
End With

Application.ScreenUpdating = True

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub

Open in new window

William MimmsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Give this a try.  I removed the attachment of the document, but you can certainly put that back if you want it both in the Body and attached.

I assumed you didn't want just the text, but wanted formatting and images as well.

Hopefully this gets you close...

Private Sub Submit_Click()
    Dim OL          As Object
    Dim EmailItem   As Object
    Dim Doc         As Document
    Dim Editor      As Object
    Const olFormatRichText = 3

    Application.ScreenUpdating = False
    Set OL = CreateObject("Outlook.Application")
    Set EmailItem = OL.CreateItem(olMailItem)
    Set Doc = ActiveDocument
    Doc.Content.Copy
    Doc.Save

    With EmailItem
        .Subject = "Quote Request"
        .To = "wmimms@metalworkinggroup.com"
        .CC = "wnmimms@gmail.com"
        .Importance = olImportanceNormal
    '    .Attachments.Add Doc.FullName
        .BodyFormat = olFormatRichText
        Set Editor = .GetInspector.WordEditor
        Editor.Content.Paste
        .Display
    End With

    Application.ScreenUpdating = True

    Set Doc = Nothing
    Set OL = Nothing
    Set EmailItem = Nothing

End Sub

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
William MimmsAuthor Commented:
Bill, Thanks so much!  Really appreciate the help!
0
Bill PrewCommented:
Welcome, glad that was useful.


»bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.