Automating Outlook from Other Applications

Outlook has a very powerful and complete object model. This enables you to perform many of the tasks you do every day in Outlook from other applications. You can write Microsoft Word macros that send email to colleagues, use Microsoft Access to send status messages from a database, and even use Visual Basic to create custom applications that do all sorts of things such as email inventory reports to managers and sales representatives. For example, the following code creates an Outlook message, enters recipient information, sets a subject and priority, adds an attachment, and sends the email message:

 Sub SendEmail() Set objOutlook = CreateObject("Outlook.Application") Set objNS = objOutlook.GetNamespace("MAPI") ...

Get Special Edition Using® Microsoft® Office Outlook® 2003 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.