Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Automation - data source included

Status
Not open for further replies.

foxteam1

IS-IT--Management
Jul 28, 2006
8
Hi

I have word automation with VFP9 that is using VFP calls to create Word merge documents.
I see that the name of the datasource "c:\testing\themerge.dbf" is writed inside the word documents.
If other people use this document, the directory to the data is not the same,like "z:\common\themerge.dbf", and the directory to the file "themerge.dbf" must be redefined by the customer in Word (in the main content,tools ...)
Can i erase the the name of the datasource of the prepared documents, or a way to not write this stuff, and used automation orders in the software to redefined the good directory to the data for my customers.

Thanks for any suggestions you may have
and sorry for my poor english

Franck
 
Hi Franck,

Before you deploy your mail merge document, detach it from its datasource. To do that make the Mail Merge Toolbar visible. Click on the Main Document Setup button and select 'Normal Word Document' from the resulting dialog.

Then before you execute the Merge in automation, use the MailMerge.OpenDataSource() method to connect the document to the datasource in the appropriate location. See the Word macro help file for more information on the parameters that method needs. There are lots of them and they all have default values. One I am fairly sure you will need is the Connection parameter, which is the 12th. So that means you have to pass all 11 prior to that one in the correct order and with the correct data types.

I quit using DBFs as Word data sources in 1998 when there were so many problems with the VFP ODBC driver, so I don't know what your Connection parameter will have to look like.

pamela

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top