Can anyone tell me why the following code causes an error when executed within Word?? I'm getting a "run-time error 424 object required"
I am trying to cycle through my word document and replace all mail merge fields with If statements to determine if they will have data or not. If they don't have data I would like to show "XX".
Any help and/or direction will be greatly appreciated!!
Thanks,
Dan
Code:
ActiveDocument.MailMerge.Fields(i).Code = "{If {" & ActiveDocument.MailMerge.Fields(i).Code & "} =" & Chr(34) & Chr(34) & _
" " & Chr(34) & "XX" & Chr(34) & " " & "{" & ActiveDocument.MailMerge.Fields(i).Code & "}"
Any help and/or direction will be greatly appreciated!!
Thanks,
Dan