PaulHerschell
Programmer
I am having a problem mailmerging Visual FoxPro 6 with Word XP resulting in a '1429 OLE IDispatch exception code 0 from Microsoft Word: Word was unable to open the data source' error.
The curious thing about this error is that the mailmerge works fine on Word 2000, it also works fine on Word XP systems that have been upgraded from Word 2000 like my own system, however, I have had a number of customers that have upgraded from Word 97 to Word XP or just installed Word XP for the first time who get the error message.
My first thought was a problem with the ODBC drivers. I compared the machines to my own working machine and the Visual FoxPro Tables and Visual FoxPro Database entries were identical, even to the version number, not surprising I suppose as I supply the ODBC drivers with my application (using the built in Microsoft Setup program within VFP 6) in case users do not already have them installed. I removed the drivers on my PC and replicated the error, reinstalled my app and the error cleared, however the same procudure on the customer PCs made no difference - it still crashed with the 'Word was unable to open the data source' error at the .opendatasource line below.
My automation code looks something like the following in my Visual FoxPro 6 program
with oword
&& copy cursor to a temporary file on disk for use by Word mailmerge
select * from customers into table mytable
&& close new file file so not open when Word tries to open it later
use
with oword.odocument.mailmerge
.MainDocumentType = wdFormLetters
.OpenDataSource(;
"mytable",;
,;
,;
,;
,;
,;
"",;
"",;
,;
"",;
"",;
"DSN=Visual FoxProTables;UID=; PWD=; SourceDB=c:\mydir"+;
"SourceType=DBF; Exclusive=No; BackgroundFetch=Yes; Collate=MACHINE"+; "Null=Yes; Deleted=Yes;",;
"SELECT * FROM mytable",;
""
endwith
I suspect some incompatible default option in Word XP that sets itself differently when you upgrade from Word 2000 rather than earlier versions or for fresh installs, however, I am really stuck on this. Obviously I could export to different file formats and try that, however, that seems a shame when the code above has been working fine in all Word 2000 and most Word XP installations for a long time now.
Any help on this would be really appreciated. Thanks
Paul
The curious thing about this error is that the mailmerge works fine on Word 2000, it also works fine on Word XP systems that have been upgraded from Word 2000 like my own system, however, I have had a number of customers that have upgraded from Word 97 to Word XP or just installed Word XP for the first time who get the error message.
My first thought was a problem with the ODBC drivers. I compared the machines to my own working machine and the Visual FoxPro Tables and Visual FoxPro Database entries were identical, even to the version number, not surprising I suppose as I supply the ODBC drivers with my application (using the built in Microsoft Setup program within VFP 6) in case users do not already have them installed. I removed the drivers on my PC and replicated the error, reinstalled my app and the error cleared, however the same procudure on the customer PCs made no difference - it still crashed with the 'Word was unable to open the data source' error at the .opendatasource line below.
My automation code looks something like the following in my Visual FoxPro 6 program
with oword
&& copy cursor to a temporary file on disk for use by Word mailmerge
select * from customers into table mytable
&& close new file file so not open when Word tries to open it later
use
with oword.odocument.mailmerge
.MainDocumentType = wdFormLetters
.OpenDataSource(;
"mytable",;
,;
,;
,;
,;
,;
"",;
"",;
,;
"",;
"",;
"DSN=Visual FoxProTables;UID=; PWD=; SourceDB=c:\mydir"+;
"SourceType=DBF; Exclusive=No; BackgroundFetch=Yes; Collate=MACHINE"+; "Null=Yes; Deleted=Yes;",;
"SELECT * FROM mytable",;
""
endwith
I suspect some incompatible default option in Word XP that sets itself differently when you upgrade from Word 2000 rather than earlier versions or for fresh installs, however, I am really stuck on this. Obviously I could export to different file formats and try that, however, that seems a shame when the code above has been working fine in all Word 2000 and most Word XP installations for a long time now.
Any help on this would be really appreciated. Thanks
Paul