#define wdFormatTemplate 1 #Define wdSendToEmail 2 #Define wdSendToFax 3 #Define wdSendToNewDocument 0 #Define wdSendToPrinter 1 SELECT * from customer WHERE country = 'Germany' INTO TABLE myfree USE lcConnStr = "DSN=Visual FoxPro Tables;SourceType=DBF;SourceDB="+; SYS(5)+CURDIR()+";" cSQLStatement1 = "SELECT * FROM myfree" * each SQL statement is limited to 255 chars * if longer, put substr(SQL,256) in 2nd cSQLstatement cSQLStatement2 = "" oWordDocument=createobject("word.application") && Create word object With oWordDocument .Documents.Add * .ActiveDocument.SaveAs(sys(5)+curdir()+'mytemplate.dot', wdFormatTemplate) With .ActiveDocument.MailMerge .OpenDataSource(,,,,,,,,,,, ; lcConnStr,; cSQLStatement1, cSQLStatement2) && Open data source .EditMainDocument && Activate the main document Endwith .Visible = .t. .Activate EndwithCetin