>>_VFP.datatoclip(alias(),reccount(),3) && Copy VFP table to clipboard >>oWord.editpaste && Paste to word >>*No memo (memo is pasted like in Browse memo-Memo)Cetin
************************************************** * Start of code ************************************************** USE (home()+"samples\data\customer") GO 18 _VFP.datatoclip(alias(),1,3) && Copy VFP table to clipboard - Just recno()=18 LOCAL ix LOCAL array aNewFieldNames[fcount()] && Will change some headers later FOR ix=1 to fcount() aNewFieldNames[ix] = field(ix) * open database (home()+"samples\data\testdata") * dbgetprop(alias()+"."+field(ix),"Field","Caption") is a shorcut * if captions already have your new field titles ENDFOR aNewFieldNames[1] = "Customer Id" aNewFieldNames[2] = "Company Name" aNewFieldNames[3] = "Pls Contact To" USE PUBLIC oWordDocument *** set the LOCALEID to English nlLocaleId=sys(3004) && Save local id =sys(3006,1033) && We will be sending instructions in English WAIT window nowait "Creating Word Document..." && Inform user oWordDocument=createobject("word.basic") && Create word object WITH oWordDocument .appshow && Show word app .filenewdefault && New file, default template - this is our main doc .MailMergeCreateDataSource("c:\temp\xmergedoc") && Create datasource .MailMergeEditDataSource && Edit data source .editselectall && Select entire doc - has default fields now .editpaste && Clipboard data pasted to word - paste over .editfind(" ","",0,0,0,0,0,0,,1,,1) && Remove spaces - otherwise header fail .editselectall && Select entire doc .texttotable(1) && Convert text to table - tabs (1) (Word table) .editgoto("\Table") && Go to predefined bookmark \Table - Start of table .nextcell .prevcell && .nextcell .prevcell to select first cell FOR ix=1 to alen(aNewFieldNames) .insert(aNewFieldNames[ix]) && Set new headers - user can understand better .nextcell && Go next cell ENDFOR .tabledeletecolumn && Delete extra column .MailMergeEditMainDocument && Activate the main document ENDWITH **** Set the LocaleId to the previous value =sys(3006,val(nlLocaleId)) ************************************************** * End of code **************************************************I think this code already has the answers and I dispersed them between your questions. While ODBC seem to be slow it has an option to link to source. In fact I think what is so slow is not ODBC nor VFP but word itself. And as Barbara pointed out word could directly use a DBF too. I wrote mailmerge class preserving OOP and in the name of OOP and ODBC support didn't do it with old indian trick (export to ie:Excel type file or delimited with tab, in word insert that file-faster than ODBC).