Solved

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

Posted on 2008-10-13
1
665 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

Suggested Solutions

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

739 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