MAIL MERGE MACRO

A

Anthony Hellard

Using Outlook 2002 SP3.

Could anyone advise me if it is possible to write a VBA scipt to automate
the following proceedure:
(and preferable show me how!)

Selext Contacts
Select a single addressee
Click on Mail merge
Once the mail merge form appears -
click "only selected Contacts"
Click "Existing Document and enter "C:\My Documents\Print\Envelope DL
Long.doc"
Click OK to sent merge to Word.

In Word I have a macro that selects the correct printer, sends the document
to Print and closes the file.

Any help on this would be much appreciated

Tony
 
S

Sue Mosher [MVP-Outlook]

No, it's not possible to do precisely that, at least not without a SendKeys
kludge. The limitation is that Word mail merge does not support the direct
use of Outlook contacts as a merge source -- just as Word itself does not.
If you want a Word merge closely, you'll see that merging with Outlook data
uses an intermediate data source built from the selected contacts.

You probably see where this is heading: The solution is for your code to
create that intermediate data source from the selected contacts
(Application.ActiveExplorer.Selection). It could be a comma-delimited text
file, an Excel file, Access, etc. Then you can use that file as the
datasource for the merge, using Word's MailMerge objects and methods, which
are documented with examples in the Word VBA Help file.

The page at http://www.outlookcode.com/d/customimport.htm includes links to
many samples, including one to export Outlook contacts to Excel.
 
A

Anthony Hellard

Thanks for the reply Sue, actually I would be more than happy to just have
the Outlook Mailmerg form completed as stated. A bonus would be to auto
send the info to the merg document instead of clicking the OK button.

Tony
 
S

Sue Mosher [MVP-Outlook]

As I said, it is not possible to complete the Outlook mail merge dialog
except with a SendKeys kludge that duplicates the keystrokes. Information on
SendKeys is in Help.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top