D
Drew
I am attempting to convert a plain text document that contains certain
variables as delimited by the "@" or other user specified delimiters
and I can't seem to get the merge fields to position themselves in the
proper location. What currently happens is that the variables are
successfully removed, but the merge fields are all placed at the end of
the document. Also, any merge fields that have more than one word in
the field name is truncated to only the first word of the field's name.
The code that I am using is below:
With objWord.Content.find
rsVariableDefinitions.MoveFirst
Do Until rsVariableDefinitions.EOF 'loop
through variable definition table and replace text with their merge
fields
.Execute strDelimiter &
rsVariableDefinitions!Variable & strDelimiter, , True, , , , True, , ,
"", True 'Delete the variable placeholder
If .Found Then
Let strField =
rsVariableDefinitions("Field")
objWord.MailMerge.Fields.Add
oSel.Range, strField
End If
rsVariableDefinitions.MoveNext
Loop
End With
Can any one please help!
Thanks, Drew
variables as delimited by the "@" or other user specified delimiters
and I can't seem to get the merge fields to position themselves in the
proper location. What currently happens is that the variables are
successfully removed, but the merge fields are all placed at the end of
the document. Also, any merge fields that have more than one word in
the field name is truncated to only the first word of the field's name.
The code that I am using is below:
With objWord.Content.find
rsVariableDefinitions.MoveFirst
Do Until rsVariableDefinitions.EOF 'loop
through variable definition table and replace text with their merge
fields
.Execute strDelimiter &
rsVariableDefinitions!Variable & strDelimiter, , True, , , , True, , ,
"", True 'Delete the variable placeholder
If .Found Then
Let strField =
rsVariableDefinitions("Field")
objWord.MailMerge.Fields.Add
oSel.Range, strField
End If
rsVariableDefinitions.MoveNext
Loop
End With
Can any one please help!
Thanks, Drew