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 / Word / Mailmerge and Fax / October 2004

Tip: Looking for answers? Try searching our database.

Command line MailMerge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PMTRCPMTRC - 19 Oct 2004 21:06 GMT
Is it possible to issue a command from the command line that would load a Word template file (.dot) and automatically merge it with a text data file (.txt) and display the merged result to the user?  

PMC
Doug Robbins - 20 Oct 2004 01:23 GMT
Check out the "Customize how Word starts" item in the built in Help to see
how to add a switch the command line (in this case \t) to have Word start
with a new document based on a particular particular template.  If that
template has an autonew macro in it to execute the merge, then you will have
what you want.  Check out Mailmerge in the Visual Basic help file to get the
commands and syntax that you will need for the macro.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

Is it possible to issue a command from the command line that would load a
Word template file (.dot) and automatically merge it with a text data file
(.txt) and display the merged result to the user?

PMC
Peter Jamieson - 20 Oct 2004 13:46 GMT
A couple of additions to Doug's post: If you want to specify the data source file on the command line
a. your macro will need to get the complete command line using whatever facilities are available (you may need to use a Win32 function to do it).
b. because Word tries to find any attached data source before it even executes things such as AutoNew and AutoOpen, and because you cannot trap the error if the data source is not present or is invalid, you must either
- ensure that the data source the document expects is there. Once Word has attached it, your macro can change it or
- detach the document/template from the data source before you save it, i.e. set the document/template to be a "Normal Word document". You will lose any sort or filter parameters, but MERGEFIELD and other merge-related fields should still remain.

Signature

Peter Jamieson

 Is it possible to issue a command from the command line that would load a Word template file (.dot) and automatically merge it with a text data file (.txt) and display the merged result to the user?  

 PMC
 
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.