View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod
 
Posts: n/a
Default Using IF to find whether a Merge Field contains a substring

Hi Joshua,

This is easy enough to do with wildcards in the field coding if the
substring always starts at the same position in the overall string. For
example, if the substring to look for always begins at the 5th character:

{IF{MergeField MyData}= ????TestString* "True Result" False Result"}

For anything involving variable string positioning, a field-code solution
could be horribly complex.

Cheers


"Joshua Pangborn" wrote in
message ...
I am merging some letters, and I have a merge field that lists a number of
codes separate by new lines. I need to include another document if a
particular code is in the mergefield. I know that you can use IF

MergeField =
"string", but that returns false. I have tried IF MergeField = "*string*",
but that also returns false. Is there another way to test if a merge field
contains a string? Thanks. I can provide more information if needed.
--
- Joshua Pangborn