Email MailMerge strMailBody Question
Thanks for the quick reply Doug. I only had to make one minor change to your
code.
You noted the following line in the Else statement.
objMerge.DataSource.DataFields("FirstName")
I had to change it to the following.
strAddressee = objMerge.DataSource.DataFields("FirstName")
Your recommendation does exactly what I needed. I really appreciate your
assistance.
Take care,
Chris
--
Regards,
Chris
"Doug Robbins - Word MVP" wrote:
Use:
Dim strAddressee as String
If objMerge.DataSource.DataFields("ParentsName") "" then
strAddressee = objMerge.DataSource.DataFields("ParentsName")
Else
objMerge.DataSource.DataFields("FirstName")
End if
strMailBody = _
vbCrLf & vbCrLf & "Hello " & _
strAddressee & "," & _
vbCrLf & vbCrLf & _
"Please find attached a receipt for your recent payment." & vbCrLf &
vbCrLf & _
"Don't hesitate to contact me should you have any questions." & vbCrLf
& _
vbCrLf & _
"Regards," & vbCrLf & _
"Chris"
--
Hope this helps,
Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
"eckert1961" wrote in message
...
Hello,
I am using the following code to construct the strMailBody in Word 2003
VBA
module.
strMailBody = _
vbCrLf & vbCrLf & "Hello " & _
objMerge.DataSource.DataFields("FirstName") & "," & _
vbCrLf & vbCrLf & _
"Please find attached a receipt for your recent payment." & vbCrLf &
vbCrLf & _
"Don't hesitate to contact me should you have any questions." &
vbCrLf
& _
vbCrLf & _
"Regards," & vbCrLf & _
"Chris"
This works but I would like to change this to do the following. I need to
check the .DataFields(ParentsNames) to see if it's null. If it is then
enter
.DataFields(FirstName). If it isn't null then I want to enter
.Datafields(ParentsNames).
What is the required syntax? Thanks in advance.
Regards,
Chris
.
|