Hangin Bookmarks

D

DCA

Hello,

I am setting a word doc up to print out letters with mail merge. Depending
on the value of one of the mail merge fields bookmarked text gets inserted.
This is the code I've written:

{IF {MERGEFIELD "MAILCELL"} = "1H" "{INCLUDETEXT C:\CELL.DOC CELL_1G2G}" ""}
{IF {MERGEFIELD "MAILCELL"} = "2H" "{INCLUDETEXT C:\CELL.DOC CELL_5F}" ""}
and so on.

The code works well, but sometimes there will be two bookmarks generated.
For instace the text for 1H will be at the end of the text for 2H when the
value is 2H.
Any ideas? Could it be realted to the values starting with numbers (just a
thought seems to be some kind of correlation with bookmarks and values
causing problems when they start with numbers)?

Thank you.
 
D

DCA

Update.

Actually the example I posted was wrong. If I have values 1H, 2H, 3H and
1G, 2G, 3G it seems to be adding the bookmarks for both the 1H and 1G or both
the 2s or 3s. Also is the "" before the last } needed?

Thank you.
 
D

Doug Robbins

I think it might be best if you reposted this as one message that is
complete in itself as I do not really understand what you have. One thing
though, the

INCLUDETEXT C:\CELL.DOC CELL_1G2G

would need to be:

INCLUDETEXT C:\\CELL.DOC CELL_1G2G

And also, you may need to use Ctrl+A to select all and then F9 to update the
fields in the document to get the correct text to display.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

DCA

Sorry about the double post, I don't know how to edit my posts.

The above is just an example, in the real document it is C:\\, good catch
but I did say that the statements work.

To clarify your misunderstanding, as I generate these mail merged documents
a bookmarked text is being added that shouldn't be. The if statements should
append the bookmarked text only when the MERGEFEILD "MAILCELL" equals their
set value. However, sometimes (for example) the value equals 1H and the text
for 1H and 1G will be added.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top