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
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