THIS.OpenMailMerge () && Open the main document and set the datasource > >*-- Set the page options >WITH THIS.oWord.ActiveDocument.PageSetup && THIS.oWord point to the instance of Word > .Orientation = 0 && wdOrientPortrait > .TopMargin = THIS.oWord.CentimetersToPoints (2.5) > .BottomMargin = THIS.oWord.CentimetersToPoints (2.5) > .LeftMargin = THIS.oWord.CentimetersToPoints (2.5) > .RightMargin = THIS.oWord.CentimetersToPoints (2.5) > .Gutter = THIS.oWord.CentimetersToPoints (0) > .HeaderDistance = THIS.oWord.CentimetersToPoints (0) > .FooterDistance = THIS.oWord.CentimetersToPoints (0) > .PageWidth = THIS.oWord.CentimetersToPoints (21.59) > .PageHeight = THIS.oWord.CentimetersToPoints (27.94) > .OtherPagesTray = 0 && wdPrinterDefaultBin > .SectionStart = 2 && wdSectionNewPage > .OddAndEvenPagesHeaderFooter = .T. > .DifferentFirstPageHeaderFooter = .F. > .VerticalAlignment = 0 && wdAlignVerticalTop > .SuppressEndnotes = .F. > .MirrorMargins = .F. > THIS.SetTray (THIS.nBac, THIS.oWord.ActiveDocument.PageSetup) && Set the paper tray > .OddAndEvenPagesHeaderFooter = .F. > .TwoPagesOnOne = .F. > .BookFoldPrinting = .F. > .BookFoldRevPrinting = .F. > .BookFoldPrintingSheets = 1 > .GutterPos = 0 && wdGutterPosLeft >ENDWITH > >*-- Run the mailmerge >WITH .oWord.ActiveDocument.MailMerge > .Destination = 0 && New document > .DataSource.FirstRecord = 1 > .DataSource.LastRecord = RECCOUNT (m.lcData) && Total number of records of the datasource > .SuppressBlankLines = .T. > .Execute () && Run the mailmerge >ENDWITH > >THIS.oWord.Documents(THIS.cMMDocument).Close (0) && Close the main document > >*-- Print each page separatly (this goes inside a loop) >WITH THIS.oWord > .Activedocument.Sections(m.tnPageNo).Range.Select () && Select the page to print > .Selection.End = .Selection.End - 1 && Remove the end of page marker from the selection > .ActiveDocument.PrintOut (0, , 1) && Print the page <-- THIS IS THE COMMAND THAT SEND WORD IN THE NO MAN LAND >ENDWITH>Could you please, post your code for merging and printing (or gave me the link to it)?
#define wdGoToPage 1 #define wdGoToFirst 1 #define wdPrintCurrentPage 2 *-- Print each page separatly (this goes inside a loop) FOR lnPages = 1 TO lnTotalPages WITH THIS.oWord .Selection.GoTo(wdGoToPage,wdGoToFirst, m.lnPages,"") .PrintOut (0, , wdPrintCurrentPage) ENDWITH NEXT