• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 434
  • Last Modified:

Merge IF field formula not working

I have a mail merge in which I am trying to put the following formula and no matter what I do I can't get the title to show up. Can anyone see what I'm doing wrong?

What I want the formula to do is only print the heading if the merge field <<Additional_Insured_1>> is not blank.... but the heading never shows up in the merge, even when the merge field is not blank.

{IF{MERGEFIELD Additional_Insured_1} <> "" "ADDITIONAL INSUREDS:" " "}
0
boukaka
Asked:
boukaka
  • 2
  • 2
1 Solution
 
FlysterCommented:
Hi Boukaka,

See if this works for you,

ActiveDocument.MailMerge.Fields.AddIf Selection.Range, "Additional_Insured_1", wdMergeIfIsNotBlank, , , "ADDITIONAL INSUREDS", , ""

Flyster
0
 
boukakaAuthor Commented:
I added your formula into a field on the main document in curly braces {} but nothing appears when I merge. The steps I take to add the formula are hit ctrl F9 which inserts a blank merge field, and pasted your formula inside the brackets.

I then ran the merge document but .. nothing

I declined to mention earlier that in the word doc the formula sits to the left and the field that I'm checking sits to it's right like this (in case it makes any difference):

{ActiveDocument.MailMerge.Fields.AddIf Selection.Range, "Additional_Insured_1", wdMergeIfIsNotBlank, , , "ADDITIONAL INSUREDS:", , ""}       <<Additional_Insured_1>>
0
 
FlysterCommented:
Sorry. That was the vba solution. Try it this way with the extra ""

IF "{MERGEFIELD Additional_Insured_1}" <>"" "ADDITIONAL INSUREDS:" "" 
0
 
boukakaAuthor Commented:
Ah! that's what I was missing, I'm not at work to try it right now, but it looks good to me. Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now