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 / December 2004

Tip: Looking for answers? Try searching our database.

How to suppress Word dialogs during merge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ron Ford - 30 Dec 2004 16:26 GMT
I am trying to send a merge document to the printer from
the command line and would like to suppress (or
automatically answer) Word dialog questions so the entire
process can occur without user intervention.  The
datasource, test.txt, contains a single record.  
Using Word 2002 on XP Professional.

My command line is:
    \(path_to_word)\winword  docfile.dot  /mMyMerge

the Word macro is:

Sub MyMerge()
 With Active.Document.MailMerge
   .Destination = wdSendToPrinter
   .SuppressBlankLines = True
   With .DataSource
     .FirstRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
     .LastRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
   End With
   .Execute Pause:=False
   SendKeys "%N" 'To answer the 'Save' document question.
   End With
   ActiveDocument.Close
   Application.Quit
 End With
End Sub

The SendKeys successfully prevents the save document
dialog from appearing, but I haven't been able to prevent
an earlier dialog which states:

Opening this document will run the following SQL command:
  SELECT * FROM c:\testdir\test.txt
Data from your database will be placed in the document.
Do you want to continue?
   Yes  No

Since I always want the Yes option, I've tried adding
SendKeys "%Y" to every line in the macro without effect.

Is there another method of suppressing this dialog?
Many thanks.
Charles Kenyon - 30 Dec 2004 16:34 GMT
I haven't analyzed your code. I doubt I'm competent to debug it. However,
have you looked at
http://www.mvps.org/word/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm.
Signature


Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

>I am trying to send a merge document to the printer from
> the command line and would like to suppress (or
[quoted text clipped - 41 lines]
> Is there another method of suppressing this dialog?
> Many thanks.

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.