Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word XP Merge Doesn't work....
Message
From
16/06/2003 17:20:35
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Word XP Merge Doesn't work....
Miscellaneous
Thread ID:
00800552
Message ID:
00800552
Views:
51
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
Map
View

Click here to load this message in the networking platform