Newbie can't get MM to work

J

JLB

What step have I overlooked?

I'm using Word 2003 and Excel 2003.

1. Datasource: I have an Excel spreadsheet that has names, addresses and a
lettercode: 1 is a new member; 2 is a renewing member.

2. Constant Text: I created a .DOC file with four paras of "welcome" text
and four paras of "thanks for renewing" text.

I selected the first four paras, clicked on Insert -> Bookmark and gave
them a bookmark of NEWMEMBER.

I selected the final four paras, clicked on Insert -> Bookmark and gave them
the bookmark of RENEWAL.

I saved the file as c:\testMM.doc

3. Generic Letter. I opened a blank Word document; displayed the mailmerge
toolbar and clicked on the "Main Document Setup" button. Then I clicked on
"Open Data Source" and navigated to my workbook and selected the sheet in it.

4. Using the "Insert Merge Field" button I inserted the name and address
fields. Then I typed "Dear " and inserted the given name field again. The
fields all appear within the braces and show MERGEFIELD and the fieldname I
selected.

5. I wanted to choose which letter was included so I clicked on the "Insert
Word Field" button and selected "If ... Then ... Else". In the popup under
Field name I selected "Lettercode", for Comparison I chose "Equal to" and for
Compare to I chose "newmember". (No quotes, of course). For Insert this
text I entered AAAAA and clicked OK. The statement was inserted into my
blank document along with "\* MERGEFORMAT.

6. I deleted the AAAAA and clicked on Insert | Field and selected
INCLUDETEXT. In the popup I clicked on the Field Codes button which changes
the display slightly to show the prompts for [Bookmark] and [switches]. I
put c:\textMM.doc, left a space and put the bookmarkname NEWMEMBER and
clicked OK.

7. In my document I changed the c:\ to c:\\ and I put quotes around the
path-and-filename but not, of course, around the bookmark. (Interestingly
enough, if you don't click on the Field Codes button then Word will add the
quotes and the extra "\".)

8. I repeated the process for the RENEWAL lettercode and bookmark.

9. Saved the Generic Letter and exited from Word.

10. Restart Word, opened the Generic Letter and (I've tried this both ways)
either said Yes (or No) to the prompt about running the SQL statement.

11. Click on the Check for Errors button. No errors.

12. Click on the Merge to a New Document button and the new document shows
the name and address but not the four paras of text for the two bookmarks.

What is my error and what do I need to do to correct it?

btw ... I know I could (should?) use a nested IF but let's get it working in
a simple way first of all. I also know that I can't simply type {} but have
to use Ctrl+F9.

JLB
 
J

JLB

At the start of my original message I said I used a lettercode of 1 and 2.
Later on I said I used newmember and renewal. In fact, throughout my
testing, I'm actually using "newmember" and "renewal". Sorry for any
confusion.
 
G

GTS

JLB said:
At the start of my original message I said I used a lettercode of 1 and 2.
Later on I said I used newmember and renewal. In fact, throughout my
testing, I'm actually using "newmember" and "renewal". Sorry for any
confusion.
If it was me doing this merge, I would I would do it in a simpler way - by
having two complete letters enclosed in an if statement. So if lettercode =
newmember print one kind of letter, if lettercode = renewal print another
kind of letter.
Nice and simple...
Graham
 
J

JLB

Normally, I would agree. But this is expected to evolve into something more
complicated with a variety of personalized communications to/from others in
the organization. So, although your solution works and is practical for this
limited example, it doesn't solve the larger problem.
 
G

Graham Mayor

If I understand your methodology correctly, you have an Excel data file, a
boilerplate document with bookmarked text and a merge document?

If the lettercode field contains 1 or 2 then that is what you compare to eg

{IF {Mergefield Lettercode} = "1" "{INCLUDETEXT "c:\\path\\testmm.doc"
newmember }

if you add the bookmark name required to the data file, you shoukld be able
to merge the bookmarkname directly

{IF {Mergefield Lettercode} = "1" "{INCLUDETEXT "c:\\path\\testmm.doc"
{Mergefield newmember} }

See http://www.gmayor.com/mail_merge_graphics.htm the principle is the same.

What you can't do is put bookmarks in the merge document as bookmark names
must remain unique and they won't be following a merge.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


What step have I overlooked?

I'm using Word 2003 and Excel 2003.

1. Datasource: I have an Excel spreadsheet that has names,
addresses and a lettercode: 1 is a new member; 2 is a renewing
member.

2. Constant Text: I created a .DOC file with four paras of
"welcome" text and four paras of "thanks for renewing" text.

I selected the first four paras, clicked on Insert -> Bookmark and
gave them a bookmark of NEWMEMBER.

I selected the final four paras, clicked on Insert -> Bookmark and
gave them the bookmark of RENEWAL.

I saved the file as c:\testMM.doc

3. Generic Letter. I opened a blank Word document; displayed the
mailmerge toolbar and clicked on the "Main Document Setup" button.
Then I clicked on "Open Data Source" and navigated to my workbook and
selected the sheet in it.

4. Using the "Insert Merge Field" button I inserted the name and
address fields. Then I typed "Dear " and inserted the given name
field again. The fields all appear within the braces and show
MERGEFIELD and the fieldname I selected.

5. I wanted to choose which letter was included so I clicked on the
"Insert Word Field" button and selected "If ... Then ... Else". In
the popup under Field name I selected "Lettercode", for Comparison I
chose "Equal to" and for Compare to I chose "newmember". (No quotes,
of course). For Insert this text I entered AAAAA and clicked OK.
The statement was inserted into my blank document along with "\*
MERGEFORMAT.

6. I deleted the AAAAA and clicked on Insert | Field and selected
INCLUDETEXT. In the popup I clicked on the Field Codes button which
changes the display slightly to show the prompts for [Bookmark] and
[switches]. I put c:\textMM.doc, left a space and put the
bookmarkname NEWMEMBER and clicked OK.

7. In my document I changed the c:\ to c:\\ and I put quotes around
the path-and-filename but not, of course, around the bookmark.
(Interestingly enough, if you don't click on the Field Codes button
then Word will add the quotes and the extra "\".)

8. I repeated the process for the RENEWAL lettercode and bookmark.

9. Saved the Generic Letter and exited from Word.

10. Restart Word, opened the Generic Letter and (I've tried this
both ways) either said Yes (or No) to the prompt about running the
SQL statement.

11. Click on the Check for Errors button. No errors.

12. Click on the Merge to a New Document button and the new document
shows the name and address but not the four paras of text for the two
bookmarks.

What is my error and what do I need to do to correct it?

btw ... I know I could (should?) use a nested IF but let's get it
working in a simple way first of all. I also know that I can't
simply type {} but have to use Ctrl+F9.

JLB
 
J

JLB

Graham, you understand the set up.

(BTW I've "played around" a bit with the data so that I don't use code
numbers any more and, instead, use somewhat more meaningful text phrases.)

The boilerplate document has 8 paras in it with the first four given the
bookmark NEWMEMBER and the second four given the bookmark RENEWAL.

Here's an extract of the MM instructions in the mailmerge document:

«FirstName» «LastName»
«Address1»
«City» «State»

This person gets the «LetterCode» letter.

Dear «FirstName»

Ahh ... this is interesting ... when I attempted to paste the MailMerge
instructions from my mailmerge document, it appears as though they weren't
copied from the mailmerge document when I highlighted and pressed Ctrl+C to
copy them.

I'll type them here:
{ IF { MERGEFIELD LetterCode } = "newmember" "{ INCLUDETEXT
"C:\\testIncludeText.doc" newmember }" "" }

I also tried
{ IF { MERGEFIELD LetterCode } = "newmember" "{ INCLUDETEXT
"C:\\testIncludeText.doc" { MERGEFIELD newmember } }" "" }

In both cases, the output (created by clicking on the "Merge to new
Document" button) shows the name and address and the correct identifier for
the letter but the text of the letter is not showing.

I certainly appreciate any assistance you can provide.

JLB
 
G

Graham Mayor

You will need to merge to a new document, then select all (CTRL+A) then F9
to update the fields.
You don't actually need the condition -

{Includetext "C:\\testIncludeText.doc" { MERGEFIELD lettercode }}

would appear to do what you want

As for the copying and pasting of field constructions to e-mail messages,
there is code on my web site to enable you to do that.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JLB

If you were Professor Higgins in My Fair Lady you'd be singing "I think he's
got it!"

I have been expecting that clicking on the "Merge to new document" button
would create a display of the merged document with the included text so that
if I had 5 rows in the data source, I would see five fully formatted and
ready to go letters in the generated new document.

This, of course, does not happen. I get 5 letters with a single line of
text in the body: {includetext "c:\\testIncludeText.doc" xxxxx} where xxxxx
is replaced by the LetterCode.

But ... when I merge to printer I get TAH_DAH! 5 fully merged and ready to
go letters!

Thank you, too, for the tip about not using the IF ... THEN ... ELSE
constructs and simply using the LetterCode to identify the bookmark. That's
a nice little piece of indirect referencing.

I appreciate your patience. Your MVP status is, if on patience alone, well
earned!

(Now I can move on to some _slightly_ more complex constructions!)

Thanks, again.
 
G

Graham Mayor

Glad we got there in the end ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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