Solved

Want to suppress "Select Table" dialog box for Mail Merge automation with Excel data source

Posted on 2008-10-13
1
602 Views
Last Modified: 2013-11-25
I am automating a Mail Merge process in my application.   The data source is an Excel workbook created eariler by the application.  I specify the Excel workbook as the data source and the named range as the "Connection".  It works fine except that a dialog box is displayed by Word with the caption "Select Table" with the specified named range highlighted.  I have to manually click "OK" for the named range to be used as the table and then the Mail Merge completes successfully.

Is there is a way to suppress the "Select Table" dialog box which is displayed during the processing of the myDoc.MailMerge.OpenDataSource statement?

Thanks,
Ernie D

myDoc = appWord.Documents.Open(dotFile)

 

myDoc.MailMerge.OpenDataSource(Name:=gExcelFile, _

            ConfirmConversions:=False, _

            ReadOnly:=False, _

            LinkToSource:=True, _

            AddToRecentFiles:=False, _

            PasswordDocument:="", PasswordTemplate:="", _

            WritePasswordDocument:="", _

            WritePasswordTemplate:="", _

            Revert:=False, _

            Format:=Word.WdOpenFormat.wdOpenFormatAuto, _

            Connection:="AddressList", _

            SQLStatement:="SELECT * FROM 'Address Data$'", _

            SQLStatement1:="")

 

myDoc.MailMerge.Destination=Word.WdMailMergeDestination.wdSendToPrinter

 

myDoc.MailMerge.Execute(True)

Open in new window

0
Comment
Question by:grace4me
1 Comment
 

Accepted Solution

by:
grace4me earned 0 total points
ID: 22708504
Hi All,  

I have resolved this problem.   The resolution was to use the "TABLE" qualifier with the "Connection:=" parameter on line 13 of the code snippet. In other words the line:
        Connection:="AddressList", _
was changed to:
        Connection:="TABLE AddressList", _
This prevented the "Select Table" dialog window from being displayed.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now