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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing datasource in wordmerge

Status
Not open for further replies.

RoadRunnerOz

Programmer
Aug 22, 2000
128
AU
I have to keep setting the datasource to my excel file every time I open the file from Visual FoxPro
After setting the datasource I get asked if the First row of data contains column headers
After selecting OK I can the automate to my hearts content
How can I bypass this dialog and/or how can I open the document with the datasource attached?
Thanks

The code:


oWord = Createobject('Word.Application')
oword.setvisible(.T.)
*--lcfilename is a wordmerge doc that is already attached to an excel file
lcfilename = SYS(5)+SYS(2003)+"\templates\mydoc.dot")
oword.Documents.open(lcfilename) && change to .Documents.add and same issue
tcFileName = "c:\temp\mydata.xls"
*-- Above opens file with merge fields but NO datasource!oword.ActiveDocument.MailMerge.OpenDataSource( tcFileName, ;
0, .F.,,.T.,,,,,,,"Entire Spreadsheet" )

*-- opening the file from explorer by double clicking on it opens the file with the datasource!


Michael Ouellette
 
Hi Michael.

How can I bypass this dialog and/or how can I open the document with the datasource attached?

You may find the white paper and code samples from the conference session I gave on "Office Auotmation With VFP" helpful. You can download it from my web site.

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top