Merge IF field formula not working

Posted on 2006-05-05
Last Modified: 2008-02-01
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:" " "}
Question by:boukaka
    LVL 22

    Expert Comment

    Hi Boukaka,

    See if this works for you,

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


    Author Comment

    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>>
    LVL 22

    Accepted Solution

    Sorry. That was the vba solution. Try it this way with the extra ""

    IF "{MERGEFIELD Additional_Insured_1}" <>"" "ADDITIONAL INSUREDS:" ""

    Author Comment

    Ah! that's what I was missing, I'm not at work to try it right now, but it looks good to me. Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
    Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
    In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
    This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now