Quote:Since the original RFT-File after the start of the MergeFilePrint is changed.
Actually, that is not accurate. The original RTF file is
not changed by Sesame. It simply reads the original file into memory, and writes the changes out to a different file. For example, in the following code sample, "Document.rtf" is read into memory, then the modified output is written to "Result.rtf" (the .rtf file extension is omitted because Sesame will use the extension specified in the extension parameter).
MergeFilePrint("Data\Document.rtf", "rtf", "", "", "", "Data\Result", 1)
Hmmm... Now that I've looked through your code, I realize that I may have misunderstood what you meant in the statement above.
I see that you are modifying the original RTF file before MergeFilePrint() has a chance to read it. There is another way to handle the AddressBlock.
The documentation indicates that the 5th argument (called "matches") allows us to "match" the merge field names appearing in the merge file with the element names on the form. What is doesn't tell us, is that you can also "match" a merge field name with a
variable.
So, rather than modify the RTF document, you should be able to use something like the following:
MergeFilePrint(vDateiKopieNeu, "rtf", "", "", "AddressBlock=vOutputAddressBlock", "Myresult", 0)
BTW, I see you already found out that MergeFilePrint() will not overwrite an existing file, so you definately do need to keep using this:
If FileExists("C:\Sesame2\Myresult.rtf") then FileDelete("C:\Sesame2\Myresult.rtf")