Microsoft Office Tutorials and References
In Depth Information
E‑mailing a Single Worksheet
E-MAiling A singlE WorksHEET
You can e-mail a single worksheet using SendMail with Microsoft Outlook. The following macro
copies the active worksheet and sends it as the lone worksheet in its own workbook:
Sub EmailSingleSheet()
ActiveSheet.Copy
On Error Resume Next
ActiveWorkbook.SendMail “someone@anywhere.com”, “Test of single sheet”
Err.Clear
ActiveWorkbook.Close False
End Sub
SendMail can send a single worksheet as an attachment by housing that
worksheet in its own workbook and e-mailing it. SendMail does not require
specifying a Simple Mail Transport Protocol (SMTP) server; it sends the mail using your
installed mail system. This has the advantage of bypassing much of the
Outlookrelated code you’ve seen, but it comes with disadvantages, such as limited ability
to attach files, and no available CC argument.
A worksheet in Excel cannot exist on its own; a worksheet must be housed in a
parent Excel workbook.
Try iT
In this lesson, you write a macro in Excel that creates an e-mail in Microsoft Outlook for multiple
recipients and attaches the active Excel workbook to that e-mail.
lesson requirements
With recipient e-mail addresses already listed in column A, you write a macro in Excel that creates
an e-mail in Microsoft Outlook that attaches the active workbook, and populates the “To” field
with all the recipients’ names. To get the sample database files you can download Lesson 28 from
the book’s website at www.wrox.com .
step-by-step
1.
In column A of your worksheet, list a few sample recipient names. For example:
In cell A1 enter no_one@nowhere.com
In cell A2 enter anyone@anywhere.com
In cell A3 enter someone@somewhere.com
 
Search JabSto ::




Custom Search