Hi,
We have a little tool that opens a Word template, get some data via a CSV file, does a mailmerge and saves the result.
This worked correct with Word97 (Word8), but with Word2003 (Word11) it causes Word to crash under specific circumstances when saving the document (However, the document is saved correctly).
The circumstances are:
1) (at least) one of the mailmerge fields must be located in a textfield. (Fields in 'normal' textflow (so outside textfield) work correct)
2) the value for that field must contain the a vbCRLF (chr(13) & chr(10)).
3) The saveas operation must be done via OLE from VB6. (saveas directly from the Word application works file)
4) Word 2003 is installed on the pc (Word97 works fine)
All four conditions must be met to cause the crash. If one condition is not fullfilled, the operation works correctly.
If all conditions are met, the mailmerge is performed correctly, but during the saveas operation, Word crashes but after actually saving the document. In VB the error "Run-time error -214747851 (80010105) Automation error" (in German: -214747851 Automatisierungsfehler
Ausnahmefehler des Servers.) is raised.
I already figured out that when removing the vbCr chars (so replacing vbCr & vbLf by vbLf) from the mailmerge fields, the operation seems to work correctly.
I searched on the Microsoft site, but couldn't find any information about this issue.
Does anyone know about this issue?
Is my approach (removing vbCr from mailmerge fields) correct or are there any known unwanted side effects?
Are there other alternatives to solve this issue?
Thanks in advance.
Cheers,
Roger Niesten
We have a little tool that opens a Word template, get some data via a CSV file, does a mailmerge and saves the result.
This worked correct with Word97 (Word8), but with Word2003 (Word11) it causes Word to crash under specific circumstances when saving the document (However, the document is saved correctly).
The circumstances are:
1) (at least) one of the mailmerge fields must be located in a textfield. (Fields in 'normal' textflow (so outside textfield) work correct)
2) the value for that field must contain the a vbCRLF (chr(13) & chr(10)).
3) The saveas operation must be done via OLE from VB6. (saveas directly from the Word application works file)
4) Word 2003 is installed on the pc (Word97 works fine)
All four conditions must be met to cause the crash. If one condition is not fullfilled, the operation works correctly.
If all conditions are met, the mailmerge is performed correctly, but during the saveas operation, Word crashes but after actually saving the document. In VB the error "Run-time error -214747851 (80010105) Automation error" (in German: -214747851 Automatisierungsfehler
Ausnahmefehler des Servers.) is raised.
I already figured out that when removing the vbCr chars (so replacing vbCr & vbLf by vbLf) from the mailmerge fields, the operation seems to work correctly.
I searched on the Microsoft site, but couldn't find any information about this issue.
Does anyone know about this issue?
Is my approach (removing vbCr from mailmerge fields) correct or are there any known unwanted side effects?
Are there other alternatives to solve this issue?
Thanks in advance.
Cheers,
Roger Niesten