View Single Post
  #1   Report Post  
Denise
 
Posts: n/a
Default Trying to suppress Select Table box in Excel-Word mailmerge

Hello

Using Office 2002 SP-2, Windows 2000 V5.0 SP-4.

I have been handed a mailmerge problem, involving merging data from Excel
into a Word document. It's one of those 'it used to work but now it
doesn't' scenarios.

An Excel spreadsheet has some code, which calls a Word mailmerge document,
which subsequently calls another Excel spreadsheet with the merge data in
it. Apparently the process stopped working at some point and, when you run
the code in Excel, it opens the Word doc as an ordinary document, with no
reference to it being a mailmerge doc. If you open the Word doc on its
own, say through Explorer, it understands that it is a mailmerge doc.

I added to the existing code in the Excel file to try and get it to pick up
on the fact that the Word doc was a mailmerge file. The code is as
follows:-

With .Documents("BACDBSnew.doc").MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:="C:\temp\mailmerge.xls", _
ConfirmConversions:=False, _
ReadOnly:=False, _
LinkToSource:=True, _
AddToRecentFiles:=False, _
Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="Entire Spreadsheet", _
SubType:=wdMergeSubTypeOther
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.Execute
End With

This certainly gets the whole mailmerge thing going, the problem is that I
get the Select Table dialog appearing in the Word doc, where I have to
select the sheet and untick the 'First row of data contains column
headings' box. Is there any way to automate these responses via the code,
or at least to suppress this dialog?

Sorry, it's a long story for a short question! Hopefully, though, someone
will have some ideas. I'd appreciate any help.

Thanks

Denise Crawley