Normal Topic Any easy way to change merge letter choices? (Read 1489 times)
digimom1962
Junior Member
**
Offline


Natalie Gann

Posts: 92
Location: here
Joined: Nov 26th, 2004
Any easy way to change merge letter choices?
Jul 15th, 2005 at 6:21pm
Print Post Print Post  
I finally have a working internal merge (thanx mostly to this site Grin)

I just have one problem now, they are ALWAYS adding to or re-naming the letters. I can see myself re-programing everything every couple of days. If there was a way to use a wildcard or something to just give all the letters in the directory as choices without changing programming (like *.txt does for a search) I would swear I saw something once but cannot fine a trace. (I thought one of the samples in the Baltimore conf had something similar but nothing I can find.)

Thanx
~Natalie

  

So much time and so little to do . . . strike that, reverse it.
Back to top
YIM YIM  
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: Any easy way to change merge letter choices?
Reply #1 - Jul 18th, 2005 at 8:02am
Print Post Print Post  
This is easily achieved. The code is in the current implementation of WordMerge. I'm not sure if this is available for download. WordMerge Mk V is however described in my Inside Sesame article "A Kinder and Gentler (and Simpler) WordMerge" in the January 2005 edition.
The relevant sections of code are as below:

Declare variables:

var vOK as Int      // added var for new @Shell to do a DOS Dir,  Jan 2005

// The following variables are user-modifiable

// Where the Word merge docs are stored  // NB THIS MUST END WITH a "\"
var vDocsPath as String = "C:\Sesame\WordMrg\"   


// Names of available Word merge docs (input file)
// Renamed by AMM 14 March from vListPath (to make it clearer what it does)
var vDocListPath as String = "C:\Sesame\WordMrg\DocList.txt"


// Command Line for Directory command  // this does not need to be modified.
var vDir as string = "dir /b /o:n " + vDocsPath + "*.doc >" + vDocListPath

THEN ..

// Build Word doc selection menu

// Set position of picklist to the left of and above the command button
PopupSelectPosition(4,@Xpos(ThisElement)-125,@Ypos(ThisElement)-50)

// generate current list of docs
vOK=@shell(vDir)

// Convert the document list from one-per-line to semi-colon separated if nec
vDocList = @insert(vDocListPath)
vDocList = @Replace(vDocList, @NewLine(), ";")

vSelectedDoc = @PopupMenu(vDocList, "SELECT MERGE DOCUMENT" )

If vSelectedDoc <> "" Then
{
.. and so on to use the merge document defined by vSelectedDoc.

Hope this helps!
  

Alec
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Any easy way to change merge letter choices?
Reply #2 - Jul 18th, 2005 at 1:33pm
Print Post Print Post  
Natalie,

You can also find in-depth information on what Alec is explaining in the April 2005 (Vol. 2 No. 4) Inside Sesame.

Alec wrote an incredibly helpful article called Wordmerge Made even Easier that walks you through the process of using the improved Wordmerge  (MKV) that he created with a little help from his friends.

If you are  an Inside Sesame subscriber check it out, If not you should really think about subscribing because every month there are great articles that really help in the use of Sesame and Sbasic.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: Any easy way to change merge letter choices?
Reply #3 - Jul 18th, 2005 at 5:12pm
Print Post Print Post  
wordmerge uses elements from a form. Does this mean if I have a form with a sub form I can use the sub form elements in my merge?

If not is there a way to use the information from the sub form with the merge from the primary form?

Thanks
  
Back to top
 
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: Any easy way to change merge letter choices?
Reply #4 - Jul 18th, 2005 at 7:39pm
Print Post Print Post  
Quote:
Alec wrote an incredibly helpful article called Wordmerge Made even Easier that walks you through the process of using the improved Wordmerge  (MKV) that he created with a little help from his friends.



Thanks Robert, but I can't take the credit for WordMerge. It was Tom Marcellus who put it together initially. Since then both Gordon Meigs and I, and Tom, have applied various tweaks to it to make it more modular - and hence easier to transport between applications - more versatile, and with extra error-checking.
The brilliant heart of Wordmerge is Tom's. The central lines of code, shown below, are a model of efficient programming.

     For n = 1 to @ResultSetTotal()
           ResultSetCurrentPosition(n)

           For i = 1 to @CountStringArray(vNames)
                vData += @(@AccessStringArray(vNames,i)) + "^"
           Next
           FileWriteLn(vFileHandle, vData)
     Next
  

Alec
Back to top
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: Any easy way to change merge letter choices?
Reply #5 - Jul 18th, 2005 at 7:42pm
Print Post Print Post  
Quote:
wordmerge uses elements from a form. Does this mean if I have a form with a sub form I can use the sub form elements in my merge?

If not is there a way to use the information from the sub form with the merge from the primary form?



Sure. If you can access the data in the subform records you can include it in the mailmerge. You would run the mailmerge from the main form so you get one record per main form record.  You wouldn't be able to use Wordmerge as-is though, as it uses a list of Layout Elements. You would substitute (or add) variables which look up the subform data.
  

Alec
Back to top
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: Any easy way to change merge letter choices?
Reply #6 - Jul 18th, 2005 at 7:56pm
Print Post Print Post  
Thanks for the information Alec. What you said is I can not just use the layout element name as it is in the sub form.

I will need to create new elements in the main form and then retrieve the data from the Sub form elements into the main form elements to use wordmerge.


Have you or anyone ever heard of the error Word was unable to open data source at step 6 of page 275 of guide?

All is as written but no matter what data source I select I receive that error. Sesame is sending the right data to the merge file. I am not able to get from that file into the word document.
  
Back to top
 
IP Logged
 
digimom1962
Junior Member
**
Offline


Natalie Gann

Posts: 92
Location: here
Joined: Nov 26th, 2004
Re: Any easy way to change merge letter choices?
Reply #7 - Jul 18th, 2005 at 10:15pm
Print Post Print Post  
Thanx a bunch!

I will have a lot to play with when I am @ work on Friday.  I will let you know when I get it working!

~Natalie
  

So much time and so little to do . . . strike that, reverse it.
Back to top
YIM YIM  
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: Any easy way to change merge letter choices?
Reply #8 - Jul 19th, 2005 at 10:21am
Print Post Print Post  
Quote:
Thanks for the information Alec. What you said is I can not just use the layout element name as it is in the sub form.

I will need to create new elements in the main form and then retrieve the data from the Sub form elements into the main form elements to use wordmerge.

Have you or anyone ever heard of the error Word was unable to open data source at step 6 of page 275 of guide?

All is as written but no matter what data source I select I receive that error. Sesame is sending the right data to the merge file. I am not able to get from that file into the word document.


You don't need to add Layout Elements to your main form. You can use variables to pick up values from the subform and export those using wordmerge.

Any number of glitches could cause the problem you talk of. My suggestions:

* Use the latest Wordmerge Mk V. It has extra error-checking so you can see if things are in the right place rather than just have it not work.
* Use a simple location for your files. I use C:\Sesame\WordMrg\.
(nb not "Wordmerge".
* Have a simple export initially - just a couple of fields.
* Use LE names, not field names, for your LE list. Typos in LE names are a common problem. Ensure LE names don't include invalid characters or words, like "Date Issued".
* Put some WriteLn calls in your programming to check the status of things as they move on.
* If all else fails, contact support@lantica.com. The guys there will be pleased to help you.

  

Alec
Back to top
IP Logged