ExecWordMailMerge ("YourDocument.doc", 1) Function ExecWordMailMerge && Activates MS-Word e Executes a Mail Merge *-------- ----------------- LParameters pWordMainDocument, pCopies Local cWordMainDocument, nCopies, oWord, oDocument, nError cWordMainDocument = xProper (FullPath (AllTrim (pWordMainDocument))) nCopies = IIf (pCopies = 0, 1, pCopies) nError = 0 On Error nError = Error () If IsAppRunning ( "OpusApp" ) && Checks to see if MS-Word already running oWord = GetObject (,"Word.Application") && Connects to the existing instance else oWord = CreateObject ( "Word.Application") && Creates a new instance endif If nError <> 0 MessageBox ("Error (" + Transform (nError, "@L 9999") + ") occurred activating MS Word. Please check.", (0+16+0), "Mail Merge") Return endif oWord.Application.Visible = .T. oWord.Application.WindowState = 2 oDocument = oWord.Documents.Open (cWordMainDocument, 0, 0, 0) && Opens document (<FileName>, <Convert>, <ReadOnly>, <AddToRecentFiles>) wdSendToNewDocument = 0 oDocument.MailMerge.Destination = wdSendToNewDocument oDocument.MailMerge.Execute bBackGround = .F. nPrintRangeType = 0 && 0 - Print All Document, 1 - Selection, 2 - Curr Page, 3 - cFrom, cTo, 4 - Range of Pages (cPageRange) cFileName = "" && Name of File to be generated (bPrintToFile must be .T. cFrom = "0" cTo = "0" cCopies = lTrim (Str (nCopies)) cPageRange = "" && Ex "1-3; 5; 12; 50-56" bPrintToFile = .F. oDocument.Close (0) && Close without asking for "Save as" oWord.ActiveDocument.PrintOut (bBackGround , , ; nPrintRangeType, ; cFileName , ; cFrom , ; cTo , , ; cCopies , ; cPageRange , , ; bPrintToFile ) If nError <> 0 MessageBox ("Error (" + Transform (nError, "@L 9999") + ") occurred while printing document. Please check.", (0+16+0), "Mail Merge") Return endif oWord.ActiveDocument.Close (0) && Close without asking for "Save as" Release oWord Return .F. EndFunc && Of ExecWordMailMergeHope it helps,