Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Publisher / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Automate Mailmerge of several files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DavidO - 25 Jul 2005 22:02 GMT
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?
Ed Bennett - 25 Jul 2005 23:28 GMT
> I have several different Publisher files that I mail-merge every day
> with different data sources that get dumped once a day from a
[quoted text clipped - 4 lines]
> 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.

Signature

Ed Bennett - MVP Microsoft Publisher

DavidO - 26 Jul 2005 03:42 GMT
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.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.