N
name
Hi
I need some help with some prompts that i have inserted into a mailmerge
template.
I export data out from a database to a txt document in comma deliminated
form for columns and linefeed as record values.
I then use the following code to merge the document:
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Temp\Export.txt", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:=""
Dim srcDoc As Word.Document
Set srcDoc = ActiveDocument
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
.DataSource.Close
End With
srcDoc.Close (False)
This works really. But the user requires a few extra fields at run time and
so I use Fill-In fields. The code launches the template document; which
spawns a new document; which is the actual finished merged document; this
means the request for the fill-in fields appears twice because two documents
actually load up. I have tried to supress the first call of fill-in fields
from the template and just keep the calls from the merged document it self. I
have been unsuccesful.
Can any one help?
Thanks
name
I need some help with some prompts that i have inserted into a mailmerge
template.
I export data out from a database to a txt document in comma deliminated
form for columns and linefeed as record values.
I then use the following code to merge the document:
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Temp\Export.txt", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:=""
Dim srcDoc As Word.Document
Set srcDoc = ActiveDocument
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
.DataSource.Close
End With
srcDoc.Close (False)
This works really. But the user requires a few extra fields at run time and
so I use Fill-In fields. The code launches the template document; which
spawns a new document; which is the actual finished merged document; this
means the request for the fill-in fields appears twice because two documents
actually load up. I have tried to supress the first call of fill-in fields
from the template and just keep the calls from the merged document it self. I
have been unsuccesful.
Can any one help?
Thanks
name