Word

Display email item with content of document or attach it.

Ease of Use

Easy

Version tested with

2000, 2003 

Submitted by:

MOS MASTER

Description:

Programmatically Display Email item with the content of the active document in the body or active document as attachment. 

Discussion:

A quick way to set up an Email item with the content or the active document as attachment. The value add is that there is still room to make adjustments to the email item before you send it. 

Code:

instructions for use

			

Option Explicit Sub DisplayContentInEmail() 'Display Content of activedocument in Email item to send it With Application .Options.SendMailAttach = False .ActiveDocument.SendMail End With End Sub Sub DisplayAttachDocumentInEmail() 'Display activedocument as attachment in Email item to send it With Application .Options.SendMailAttach = True .ActiveDocument.SendMail End With End Sub

How to use:

  1. Open your Word document.
  2. Press Alt + F11 to open VBE.
  3. Insert-Module. (Insert -> module)
  4. Paste the code there in the window at right. (F7)
  5. Close VBE (Alt + Q or press the X in the top right hand corner).
  6. Save the file.
 

Test the code:

  1. From Word, press Alt + F8 to open the macro dialog box.
  2. Select DisplayContentInEmail for the document content in the email item.
  3. Select DisplayAttachDocumentInEmail to attach the activedocument to the email item.
  4. Click Run.
 

Sample File:

Display email item.zip 5.68KB 

Approved by mdmackillop


This entry has been viewed 99 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express