Reply
 
Thread Tools Display Modes
  #1   Report Post  
Ron Ford
 
Posts: n/a
Default How to suppress Word dialogs during merge

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.





  #2   Report Post  
Charles Kenyon
 
Posts: n/a
Default

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/MailMe...PrintrWVBA.htm.
--

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.

"Ron Ford" wrote in message
...
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.







Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In typing dates in Word, i.e. "January 12" how do you keep the "1. Carol Microsoft Word Help 2 January 12th 05 08:09 PM
word xp crashes after macros are recorded kharris0405 Microsoft Word Help 3 January 11th 05 10:50 PM
WP Delay Code - Word Equiv Mike G - Milw, WI Microsoft Word Help 6 January 10th 05 04:12 PM
macro in word js Microsoft Word Help 1 December 28th 04 03:01 AM
suppress invalid merge field word 2003 Mike Mailmerge 3 December 9th 04 11:13 AM


All times are GMT +1. The time now is 08:08 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"