Hi. I have a program that opens word via automation and merge data from an Excel file. ODBC Connection information is stored in the document. When I run the oDocument.MailMerge.Execute() command, Word generate an exception error:
...document is not a mail merge main document. If I open the same document directly from Word 2002 a popup message shows up asking me if I want to run the sql statement for the mail merge. If answer 'yes' document opens fine.
What could be the problem with the automation?
Word: 2002
OS: XP Pro
RELEASE ALL LIKE o*
LOCAL oDocument
PUBLIC oWord
oWord = CreateObject("Word.Application")
oWord.Visible = .t.
oDocument = oWord.Documents.Open("MailMerge.doc")
oDocument.MailMerge.Execute()