Mailing labels template with MailMerge automation and SQL VIEW

A

ALPHA DAVIS

Hi,
I've created a Word template of mailing labels and the data source is a
SQL2000 view. It's working just fine when I click on the Merge icon on the
menu. I want the template to automatically merge the data source and crate
the labels when I double click on the file (not open to edit the template),
which creates a new document based on this template, without having to click
on the Merge icon on the menu. I added the following VBA code but it is
still not merging automatically. I appreciate some suggestion or help on
how to make this work.
p.s., what is a Main Document definition? I think the State condition below
is verifying for a Main documetn.

Private Sub Document_New()
If ActiveDocument.MailMerge.State = wdMainAndDataSource Then
ActiveDocument.MailMerge.Execute
End Sub
 
C

Cindy M -WordMVP-

Replied to duplicate question posted in one of the word.vba
newsgroups.

Cindy Meister
 

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