Solved

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

Posted on 2008-10-13
1
588 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now