There is not much programming necessary in FIVEWIN .
1) I create a mail merge recipients file which is a ASCII file.
dateineu := fcreate( cAppPath + "TempWord\recipients.txt",0)
This file has a header line where all the merge fields are stored and then as many data lines as recipients are.
hStrg:= 'EMAIL;ANREDE;NAME;VORNAME;ZUSATZ;STRASSE;LKZ;PLZ;ORT;BRIEFANRED;TITEL;FIRMA1;FIRMA2'
The merge fields and data fields are separated by a delimiter.
2) insert data and I check that there is no delimiter inside the data.
do while .not. eof()
hStrg:= ;
(STRTRAN(ALLTRIM(kunden->email ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ANREDE ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->NAME ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->VORNAME ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ZUSATZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->STRASSE ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->LKZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->PLZ ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->ORT ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->BRIEFAN ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->TITEL ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->FIRMA1 ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(kunden->FIRMA2 ), ";","," ))
FSEEK(dateineu,0,2)
lStatus:=FWRITE(dateineu,hStrg+CRLF,)
skip
enddo
3) I start word and open the selected mail merge letter.
WinExec(PathWinword + "winword.exe" + " " + cDOCFile )
4) Then complete it in word.
Note If you're creating merged e-mail messages or faxes, make sure that your data file includes a column for the e-mail address or fax number. You will need that column later in the process.
Best regards,
Otto