G
Gaz uk
Hi
I'm having trouble getting the value of a mailmerge field in to a variable.
I think I may be approaching this the wrong way but as a test I put the
following code into a template and instead of the actual value for CCode I
get <<ClientCode>>
Private Sub Document_New()
For Each mmField In ActiveDocument.Fields
If mmField.Code = " MERGEFIELD ClientCode " Then
CCode = mmField.Result
x = MsgBox("Client Code is " & CCode, vbOKOnly)
End If
Next mmField
End Sub
Is it that the value isn't coming in because the data hasn't merged yet?
I'm sure there is probably a straight forward answer but have dug around and
found nothing that works.
Thanks in advance
Gaz
I'm having trouble getting the value of a mailmerge field in to a variable.
I think I may be approaching this the wrong way but as a test I put the
following code into a template and instead of the actual value for CCode I
get <<ClientCode>>
Private Sub Document_New()
For Each mmField In ActiveDocument.Fields
If mmField.Code = " MERGEFIELD ClientCode " Then
CCode = mmField.Result
x = MsgBox("Client Code is " & CCode, vbOKOnly)
End If
Next mmField
End Sub
Is it that the value isn't coming in because the data hasn't merged yet?
I'm sure there is probably a straight forward answer but have dug around and
found nothing that works.
Thanks in advance
Gaz