This section illustrates how you can personalize a PowerPoint presentation for your
Outlook contacts, which can be an effective sales tool. The sample code below iterates
through your Outlook Contacts folder and copies a PowerPoint presentation with a
customized title slide for each contact. It then either e-mails the personalized
presentation to the contact or saves the message in your Inbox so that you can add text
and send it later. This code can be run from a Microsoft Excel, Word, or Microsoft Access
module.
The procedure, PersonalizePresentation, takes two arguments: strFileName, which is the name of a
presentation, and boolSendNow, a flag that indicates whether to send the
presentations immediately or save them in the Inbox. The procedure opens the
presentation and points a variable, txrRange, to the text of the title on the first
slide. Next it iterates through the Contacts folder and adds each Contact's full name to txrRange and saves each modified
presentation as contact name.ppt. If the contact has an e-mail address, it creates
a MailItem and saves the personalized presentation as an attachment in your Inbox
or sends it depending on which option is selected.
The code for this sample is in the modPersonalize module in XLSamp.xls. To run it, open
XLSamp.xls and click Personalize Presentation on the Tools menu. When
prompted for a presentation, browse to Sample.ppt.
Note To use this code in your own Microsoft Excel project, you must reference both
the both Microsoft PowerPoint 8.0 Object Library and the Microsoft Outlook 8.0 Object.
Note that txrRange is declared as PowerPoint.TextRange because the application
running this code may also have a TextRange object.