Word Automation

I am trying to create a merged document using Automation. I cannot save the data from my merged fields into my document. I have tried to use the following code: FileName := ‘D:\MergedDocument.DOC’; wrdApp.ActiveDocument.SaveAs(FileName); NOTE: FileName is Text(250) wrdApp is Automation → ‘Microsoft Word 9.0 Object Library’.Application When I run the code, I receive the following error: The length of the text string exceeds the size of the string buffer. Any ideas as to why I would be receiving this message? Thank You, Hannah

Try running the debugger to find the exact line of code that is causing the problem. [:)]

Good idea, but unfortunately that was the first thing I did, and that is how I found out that it was having a problem with that line of code. [:p]

Hi

quote:


Originally posted by hspaans64
… FileName := ‘D:\MergedDocument.DOC’; wrdApp.ActiveDocument.SaveAs(FileName); …


You get an error with these two lines? Strange. Did you tried it with lowercase: ‘D:\mergeddocument.doc’? Another way of trying to solve this would be to set the Length of FileName e.g. on 50. bye André

Problem solved!! [:D] It turns out it was a parameter problem, rather than a problem with the Code (wrdApp.ActiveDocument.SaveAs(FileName)). [:I] Thank you for trying to help, Hannah