C
Cole
Hi all,
I've got a data source on a remote server. The Function I wrote seems
to be opening the data source, but the actual merge is not happening.
So I end up with a document with the merge fields showing. No error
msg returned. The data source file looks like this:
1~2~3~4~5~6~7~8~9~10~11~12~13~14~15~16~17~18~19~20~21~22~23~24~25~26~27~28~
29~30~31
October 21, 2009~MS. SHIRLEY NAME~Her Addr Here~PHOENIX, AZ
zip_here~~~~data here~more data~person's name~01-number_here~OP-2009-
num_here~09/10/2009~01:42~ $11,111.00 ~Person's Name again~--------
~6212~stuff~stuff~text here ~text~2009-numeric_here~~ $1,111.00
~~numeric here ~acct # here~07/25/2009~~final text here
And the Function I created is here:
Function getDasFastMerge(params)
Dim doc, TNUM
Set doc = Word.ActiveDocument
TNUM=params(0,1) ' This is getting correct value.
const wdSendToNewDocument = 0
const wdDefaultFirstRecord = 0
const wdDefaultLastRecord = -16
const wdOpenFormatAuto = 0
const wdMergeSubTypeOther = 0
doc.MailMerge.OpenDataSource "\\svonfs\das01_exports\sdOffice
\MergeData" & Cstr(TNUM) & ".mrg",,True,True
' I've tried remarking out and unremarking these next lines - no
difference.
doc.MailMerge.Destination = wdSendToNewDocument
' doc.MailMerge.DataSource.FirstRecord = wdDefaultFirstRecord
' doc.MailMerge.DataSource.LastRecord = wdDefaultLastRecord
doc.MailMerge.Execute
getDasFastMerge = err.number & " " & err.description
End Function
The function is returning '0'. Any help would be appreciated. Thx,
Cole
I've got a data source on a remote server. The Function I wrote seems
to be opening the data source, but the actual merge is not happening.
So I end up with a document with the merge fields showing. No error
msg returned. The data source file looks like this:
1~2~3~4~5~6~7~8~9~10~11~12~13~14~15~16~17~18~19~20~21~22~23~24~25~26~27~28~
29~30~31
October 21, 2009~MS. SHIRLEY NAME~Her Addr Here~PHOENIX, AZ
zip_here~~~~data here~more data~person's name~01-number_here~OP-2009-
num_here~09/10/2009~01:42~ $11,111.00 ~Person's Name again~--------
~6212~stuff~stuff~text here ~text~2009-numeric_here~~ $1,111.00
~~numeric here ~acct # here~07/25/2009~~final text here
And the Function I created is here:
Function getDasFastMerge(params)
Dim doc, TNUM
Set doc = Word.ActiveDocument
TNUM=params(0,1) ' This is getting correct value.
const wdSendToNewDocument = 0
const wdDefaultFirstRecord = 0
const wdDefaultLastRecord = -16
const wdOpenFormatAuto = 0
const wdMergeSubTypeOther = 0
doc.MailMerge.OpenDataSource "\\svonfs\das01_exports\sdOffice
\MergeData" & Cstr(TNUM) & ".mrg",,True,True
' I've tried remarking out and unremarking these next lines - no
difference.
doc.MailMerge.Destination = wdSendToNewDocument
' doc.MailMerge.DataSource.FirstRecord = wdDefaultFirstRecord
' doc.MailMerge.DataSource.LastRecord = wdDefaultLastRecord
doc.MailMerge.Execute
getDasFastMerge = err.number & " " & err.description
End Function
The function is returning '0'. Any help would be appreciated. Thx,
Cole