General information
Category:
COM/DCOM and OLE Automation
Title:
Word XP Merge Doesn't work....
I have a foxpro 7.0 application that used the following code to merge a VFP Table (with long field names) with a Word Document. It doesn't work with Word XP, and errors out with the message: "Word was unable to open the data source." This code works fine with Word 2000. I have installed the latested FoxPro ODBC drivers (dated 12/99) I read the article on this category and downloaded the "latest" which had the same date...with no change (it still doesn't work).
oWord = CreateObject("word.application")
m.oDoc = oWord.documents.Open("my_merge.doc")
m.cMergeFileName = "c:\test\test_merge.dbf"
* This is a dbf with long field names and a dbc with the same name in the same folder. The DSN points to this file. Although it doesn't matter because of the SourceDB is and overrides the one specified in the ODBC administrator.
m.cDataSource = "DSN=Word - Merge;UID=;PWD=;"+;
"SourceDB="+JUSTPATH(m.cMergeFileName) + ;
";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;"+;
"Collate=MACHINE;Null=Yes;Deleted=Yes;"
oDoc.MailMerge.OpenDataSource( ;
m.cMergeFileName, 0,0,0,0,0,"","",0,"","", ;
m.cDataSource, "SELECT * FROM "+JUSTFNAME(m.cMergeFileName),"")
oWord.Visible = .T.
oWord.Activate()
I've heard there is a different approach in VFP 8.0 with the Foundation Class. I haven't gone to 8.0 yet. And have too many clients on 7.0 to go around updating their runtime files, etc...unless required.
Does anyone know how to fix this for Word XP? This really can drive you crazy because you would hope that code would be upwardly compatible...ha ha.
Thanks.
Bob Bartel
marketware
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only