Share via


How to: Send Workbooks by E-Mail Programmatically

You can send a workbook as an e-mail attachment. However, you cannot add text to the message you send.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Note

You must be online and connected to your e-mail system to send e-mail. SendMail uses the Messaging Application Programming Interface (MAPI).

To send a workbook as an e-mail attachment in a document-level customization

  • Call the SendMail method of the workbook and specify recipients and optionally a subject.

    Globals.ThisWorkbook.SendMail(Recipients:="[email protected]", Subject:="July Sales Figures")
    
    Globals.ThisWorkbook.SendMail("[email protected]", "July Sales Figures", missing);
    

To send a workbook as an e-mail attachment in an application-level add-in

  • Call the SendMail method of the workbook and specify recipients and optionally a subject.

    Me.Application.ActiveWorkbook.SendMail(Recipients:="[email protected]", Subject:="July Sales Figures")
    
    this.Application.ActiveWorkbook.SendMail("[email protected]", "July Sales Figures", missing);
    

See Also

Tasks

How to: Run Excel Calculations Programmatically

Concepts

Working with Workbooks

Workbook Host Item

Global Access to Objects in Office Projects

Optional Parameters in Office Solutions