Loading ...
Sorry, an error occurred while loading the content.

[Clip] Mail Merge - revisited

Expand Messages
  • Charles M. Raine
    Hi Clippers: This clip was original written by Claes Gauffin and I couldn t resist adding a little bit to it and some additional
    Message 1 of 1 , Aug 30, 1999
    • 0 Attachment
      Hi Clippers:

      This clip was original written by Claes Gauffin <gauffin@...>
      and I couldn't resist adding a little bit to it and some additional
      features. I have changed the file Open statements to give the user the
      ability to Browse to the required input files. For the address file, I have
      left the specific location (path) of my sample test file, to show how this
      can be done. I also added the IfCancel statements so the user can Quit if
      he so desires, at that point.

      I also added the SetWordWrap OFF statement because some lines of address
      can be very long which could cause problems with Word Wrap ON.

      Changed the Replace Statement to search for $$$ since single $ signs can
      easily occur (at least in North American letters).

      Added the second Replace Statement which allows for the first line of
      address (usually the name) to be inserted in the letter. For example:

      Dear ###: would be replaced by:
      Dear Charles M. Raine: if the first line of name was my name.

      This is an optional feature and the clip still works if there is no ### in
      the letter. I created a file of 140 letters in a couple of seconds using
      this clip.

      ---------< start clip >---------
      H="MailMerge"
      ; Charles M. Raine <rainec@...>
      ; 08/30/1999, 10:41:56 AM

      ^!SetScreenUpdate OFF
      ^!Open ^?{(T=O)Browse to get Address File=D:\foxb\xmas\addresse.txt}
      ^!IfCancel Exit
      ^!SetWordWrap OFF
      ^!Jump DOC_START
      ^!Set %allines%=^$GetLine$
      ^!Set %linecount%=1
      :loop1
      ^!Jump +1
      ^!Set %line%=^$GetLine$
      ^!Append %allines%=;^%line%
      ^!Inc %linecount%
      ^!If ^%linecount%<^$GetLineCount$ loop1
      ^!SetArray %adr%=^%allines%
      ^!Close
      ^!Open ^?{(T=O)Browse to get Letter File=letter.txt}
      ^!IfCancel Exit
      ^!Toolbar Select All
      ^!Set %letter%=^$GetSelection$
      ^!Close
      ^!Toolbar New Document
      ^!Set %adrctr%=1
      :loop2
      ^!InsertText ^%letter%^%NL%^%PAGE%
      ^!Replace "$$$" >> "^%adr^%adrctr%%" TIWAS
      ; The following 2 instructions replace the ### signs with the
      ; first line of Name. This is optional and works without ### signs.
      ^!Set %pos%=^$StrPos("^%nl%";"^%adr^%adrctr%%";false)$
      ^!Replace "###" >> "^$StrCopy("^%adr^%adrctr%%";1;^$Calc(^%pos%-1)$)$" TIWAS
      ^!Inc %adrctr%
      ; Next instruction was necessary to keep the letters in the same
      ; order as the address lines.
      ^!Jump Doc_End
      ^!If ^%adrctr%<=^%adr0% loop2
      ---------< end clip >-----------


      ---------< start clip >---------
      H=";"
      ; Charles M. Raine <rainec@...>
      ; 08/30/1999, 10:41:56 AM
      ---------< end clip >-----------


      ---------< start clip >---------
      H=";How to Use"
      ; Charles M. Raine <rainec@...>
      ; 08/30/1999, 10:41:56 AM
      A - Create Address File (1 line per address). Place ^ p
      (without blank between) after each line of address.

      B - Create Letter (?) with $$$ where address is required
      and ### where Name is required (if desired) as in
      Dear ###:

      C - Run MailMerge Clip.
      ---------< end clip >-----------
      |----< Copy between wrappers >----|
      | right click over the clipbook |
      | and choose "Add from Clipboard" |
      |---------------------------------|



      Charlie.

      Charles M. Raine Home Page: http://www.escape.ca/~rainec
      Phone (204) 895-0940 ICQ # 300058
      Winnipeg, Manitoba, Canada
    Your message has been successfully submitted and would be delivered to recipients shortly.