Assembling Multiple Merge Files -- supressing prompts

E

EHPorter

I have a VBA Sub that inserts quite a few documents into one big document
(the documents to be inserted are selected by check boxes)
Problem: The documents in question are all Word Merge files, that use a
specific Access database as the data source. Thus, when I run the VBA
routine, I get multiple prompts saying something like "Opening this document
will insert data from an SQL data source in your document -- Do you wish to
continue?"

What I want to do is find a way to suppress this prompt.

As an example of the problem, when I run the following:

Selection.InsertFile FileName:="Power of Attorney.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
Selection.InsertFile FileName:="Notice of Pendency.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
Selection.InsertFile FileName:="Request for Publication.doc", Range:="",
_
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak

It works, but I have to click "yes" to three successive prompts asking about
inserting the SQL data. Any way to avoid this?

Thanks.
 
C

Chad DeMeyer

Try using the Application.DisplayAlerts property. MAKE SURE your code sets
it back to wdAlertsAll in your code after all the insertions are done, and
include an OnError Goto branch that sets it back before exiting the Sub if
there is an error.

Regards,
Chad DeMeyer
 
E

EHPorter

Thank you. That works perfectly.


Chad DeMeyer said:
Try using the Application.DisplayAlerts property. MAKE SURE your code sets
it back to wdAlertsAll in your code after all the insertions are done, and
include an OnError Goto branch that sets it back before exiting the Sub if
there is an error.

Regards,
Chad DeMeyer
 

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