Hello Ollie,
This is my code.
I create a TXT file in my Fivewin program.
In Word I create a mail merge doc template (I hope this is the right name) and connect this to the data file, my txt file.
From the original template doc (docx) I always make a copy with Fivewin so that the user works with the copy.
With winexec() I call WORD and as parameter I pass the doc-file name.
Then the mass email I send with the option from WORD.
The STRTRAN I do to be sure that there are no wrong characters in the recipients file.
Regards,
Otto
First line in the Text file:
hStrg:= 'BRIEFANREDE; ... ;ORT;TELEFONNR;TELEFAXNR'
nHandle :=fopen( cDoc, O_READWRITE+S_EXCLUSIVE)
select mailing
go top
do while .NOT. Eof()
hStrg:= ;
(STRTRAN(ALLTRIM(mailing->email ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->KATEGORIE), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->ANREDE), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->NAME), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->VORNAME), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->ZUSATZ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->STRASSE), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->LKZ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->PLZ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->telefonnr ), ";","," ))+";"+;
(STRTRAN(ALLTRIM(mailing->telefax ), ";","," ))
text := fwrite(nHandle, hStrg + CRLF,)
Skip
enddo