Automate Mailmerge of several files

D

DavidO

I have several different Publisher files that I mail-merge every day with
different data sources that get dumped once a day from a database. I would
like to automate this so that the mail merge takes place on each publisher
file in the middle of the night and create a new publisher file - then when I
get there in the morning I just print the file to the printer. Is this
possible in Publisher VBA? Can I successivly open different Publisher files,
perform a mailmerge on each file and then have it append to a new publisher
file? Any suggestions?
 
E

Ed Bennett

DavidO said:
I have several different Publisher files that I mail-merge every day
with different data sources that get dumped once a day from a
database. I would like to automate this so that the mail merge takes
place on each publisher file in the middle of the night and create a
new publisher file - then when I get there in the morning I just
print the file to the printer. Is this possible in Publisher VBA?
Can I successivly open different Publisher files, perform a mailmerge
on each file and then have it append to a new publisher file?

I would suggest starting by reading some of the articles on this page:
http://www.msdn.microsoft.com/office/understanding/publisher/articles/default.aspx

I would recommend automating this procedure using an external widget. You
can code it in any language that supports COM or COM Interop.

To print the files while the script was running would probably only take one
extra line of code.
 
D

DavidO

Thank you for the informative reply. I have done a lot of VBA in Excel and
if this was Excel I'm sure I could do it - but I am just starting with VBA
for Publisher...

What is an external widget and what languages support COM or COM Interop.
Is that a seperate language "outside" of VBA that I would then use to access
the "guts" of Publisher without actully starting publisher? If so that might
be the way to go. I had read the articals in the links from the previous
post and wrote a macro that would run everytime the file was opened, it would
then close the MailMerge, re-open the Mailmerge pointing to the new datafile
(tried to have it use a CSV file but found out it likes Tab separated files
better) - then it appended to a blank publisher file. Thsi seemed to work ok
- but it chocked on larger mail-merges. So if there was a way to do this a
different way it might run better. Also, I have several Publisher files that
I need to perform a merge on each night so if an external widget would allow
me to go from one file to the next that woudl be great - I haven't figured
out how to do that yet in VBA for Publisher.

Here's the general idea of the code I have so far
Sub Document_Open()
DIM Temp as Document

ActiveDocument.MailMerge.Datasource.Close
Active Document.MailMerge.OpenDataSource ("Filename")
Set Temp = ActiveDocument.MailMerge.execute(False,
PBMergeToExistingPublication, "filename"

End Sub

Any help will be greatly appreciated.
 

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