Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Mail Merge in Word 2002 1

Status
Not open for further replies.

valdosta

MIS
Dec 18, 2002
50
US
I am working on a project that convert mail merge document from wordperfect 6.1 to word 2002. I figured out most of the problems. For some, I could not work it out. Please help me out. Thanks in advance for your great help.

My first problem is: In wordperfect, it uses "Variable" to dynamiclly type in text that you want to replace the Variable. Did anyone know how can I do this in word 2002?
Example in wordperfect:
IF(strlen((VisitationDayDate=0))GETSTRING(VisitationDayDate,Enter the Visitation Day date.;Visitation Day)ENDIF
How can I convert it to word?

Second question is: In wordperfect, example like below:
FORNEXT(i;1;STRLEN(FIELD(INTEREST_CODE));3)SUBSTR(FIELD(INTEREST_CODE);VARIABLE(i);3)ENDFOR

What is the equivalent of SUBSTR() of wordperfect in word 2002?

Thank you very much for your response!

 
For your first option, use the fields ASK and REF. To access the fields, select Insert, Field, or press Ctrl-F9 and type in the parameters.

{ ASK VisitationDayDate "Enter the Visitation Day date" \* MERGEFORMAT }{ REF VisitationDayDate }

The ASK field literally asks for data to be entered and stores it in a bookmark (or variable), and the REF field inserts the contents of the bookmark into your document.

I'm not sure what your second command is attempting to accomplish - can you provide more information?
 
Hi, GeekGirlau:

Thank you very much for the quick response! It works!!!! Really appreciate your great help!! You deserve a BIG STAR :)

FORNEXT(i;1;STRLEN(FIELD(INTEREST_CODE));3)SUBSTR(FIELD(INTEREST_CODE);VARIABLE(i);3)ENDFOR

The above command is a loop through INTEREST_CODE. The INTEREST_CODE in the data source looks like:
MS<enter>
PS<enter>
OL<enter>
......
SC

INTEREST_CODE has non-fixed length. The output after performing the above command is:
MS PS OL ... SC.

The problem is how to read sub string from a non-fixed length string.

Thank you very much for your kind help!
 
Houston, we have a problem.

Word has a NEXT field to go to the next record, however you need to insert the exact number of records you want to loop through, so this isn't going to work for you.

Then I thought of inserting a macro in the middle of the merge. Word does have a MACROBUTTON field which launches a macro, however it is not automatically run in your mail merge with other fields, and pressing F9 to update it does nothing (although you can press Alt-Shift-F9).

So there's no simple solution, but you might try something like the following, although you'd really need macro code to run it.

Create a merge document that just consists of {MERGEFIELD Interest_Code }<space>{ NEXT } over and over again - fill a whole page with it if you need to.

Set up your other merge document with a bookmark in the space where you want the interest codes inserted.

Now create a macro that merges the document containing only the interest codes. It can then select and copy the text after the merge has been performed and close the document without saving it. Now your macro merges the real document, goes to the bookmark, and pastes the interest codes.

It's a bit clumsy I know (and certainly nowhere near as elegant as your original WordPerfect codes). However it would probably work, and if not it might get you thinking of other solutions.

Best of luck!
 
Hi, GeekGirlau:

Thanks for pointing the right direction! I will try to work out a solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top