Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-13
1
Medium Priority
?
737 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

730 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