How do I select the delimiter for a mail merge?

R

Robin Tucker

Hi,

I'm using a flat text file (comma delimited) as a merge source. How can I
set the delimiter to use for the mail merge without Word asking me when I
set the data source?

ie. at present I write this code (shown below), however, word sometimes asks
me what I wish to use as the delimiter. This is true when there is just one
column in the merge data source text file. Can I set this manually using
VBA?

Thanks



' Setup the merge type.

theDocument.MailMerge.MainDocumentType = WdMailMergeMainDocType.wdCatalog

' and open the data source.

theDocument.MailMerge.OpenDataSource( _
Name:=m_MergeFileName, _
ConfirmConversions:=False, _
ReadOnly:=False, _
LinkToSource:=False, _
AddToRecentFiles:=False, _
PasswordDocument:="", _
PasswordTemplate:="", _
WritePasswordDocument:="", _
WritePasswordTemplate:="", _
Revert:=False, _
Format:=Word.WdOpenFormat.wdOpenFormatAuto,
_
Connection:="", _
SQLStatement:="", _
SQLStatement1:="")

' Destination to new document.

theDocument.MailMerge.Destination =
Word.WdMailMergeDestination.wdSendToNewDocument

' Don't copy over blank items.

theDocument.MailMerge.SuppressBlankLines = True
 
P

Peter Jamieson

No, the only way you have a chance of doing it is to connect using ODBC and
specify the delimiter for the file you want to open in the SCHEMA.INI file
in th eappropriate directory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top