Did you know that you probably integrate Excel and Outlook all the time? It's true. If you've sent or received an Excel workbook through Outlook, you've integrated the two programs; albeit manually. In this Part, we show you a few examples of how you can integrate Excel and Outlook in a more automated fashion.
Note that the macros in this Part automate Microsoft Outlook. For these macros to work, you need to have Microsoft Outlook installed on your system.
The code for this Part can be found on this book's companion website. See this book's Introduction for more on the companion website.
Macro 85: Mailing the Active Workbook as an Attachment
The most fundamental Outlook task you can perform through automation is sending an e-mail. In the sample code shown here, the active workbook is sent to two e-mail recipients as an attachment.
Some of you may notice that we are not using the SendMail command native to Excel. With the SendMail command, you can send simple e-mail messages directly from Excel. However, the SendMail command is not as robust as Outlook automation. SendMail does not allow you to attach files, or use the CC and BCC fields in the e-mail. This makes the technique used ...