Visual Basic for Applications/Outlook

This lesson introduces Outlook macros.

Objectives and Skills
Objectives and skills for Outlook scripting include:
 * Using Microsoft Outlook objects

Readings

 * 1) Microsoft: Set Reference to a Type Library
 * 2) Microsoft: Automating Outlook from a Visual Basic Application
 * 3) Microsoft: Folder Items
 * 4) Microsoft: MailItem Object
 * 5) Microsoft: MailItem Object Members
 * 6) Microsoft: How to Obtain the Email Address of a Recipient

Activities
In these activities you will create macros which interact with Outlook messages.
 * 1) Outlook Inbox
 * 2) Create a macro that pulls Inbox data from the Outlook Inbox and saves it in the active worksheet.  Include columns for SenderName, SenderEmailAddress, Recipients, CC, BCC, Subject, Size, SentOn, and ReceivedTime. Note that Recipients is a collection of Recipient objects.  You'll need to use a For or For Each loop to retrieve each of the Recipient items.  Your module should include Option Explicit, Dim, and use appropriate data types for variables.
 * 3) Generate Email
 * 4) Create an Excel macro that generates email messages based on data in the active worksheet.  Create a new worksheet with columns for Recipient, Subject, and Message.  Add one row of data for testing using yourself as the recipient, and any subject and message you like.
 * 5) Create a macro that pulls data from the worksheet and sends a new mail message to the given recipient with the given subject and message.
 * 6) Extend the macro so that it will send a new message for each row of data in the worksheet.  Test the macro with at least three rows of data.
 * 7) Outlook Calendar
 * 8) Create an Excel macro that generates calendar entries based on data in the active worksheet.
 * 9) Create a new worksheet with columns for Subject, Start Date, Start Time, End Date, and End Time.  Add several rows of data.  Include appointments, such as a class meeting schedule, and events, such as holidays when classes are not in session.  Events will have only a start date, and no ending date or times.
 * 10) Create a macro that pulls data from the worksheet and generates calendar entries for each row of data in the worksheet.  Rows with dates and times should be created as appointments.  Rows with only a starting date should be created as all day events.