|
From: gcollier on 26 Jun 2008 10:03 Hello, We have a form letter which is 2 pages. We do a mail merge from an Excel sheet. The mail merge creates a new word document with all of the form letters addressed to the different addressees. It appears that Word turns each set of pages into a section. This is fine. We then fax these to the addressees using our fax printer. I have created a macro that prints each section as an individual document which then gets faxed to the customer. The problem is the number of sections is a variable. One week it may be 90 the next it may be 100. The macro I created has 140 print sections in it. This works fine until the last section. Because the macro has 140 sections the last fax has not only the 2 pages it should have but then it back tracks and adds an additional 2 pages until it gets to 140. So the last fax may have 80 pages in it. I need the macro to understand how many sections there is and stop when it gets to the end. Any advise would be great! Thank you.
From: gcollier on 26 Jun 2008 10:36 Have discovered something. I found the below macro which works great! Ehhh in Word 2000. In Word 2007 the macro prints all sections perfectly until it gets to the last one then it adds all the previous sections. So if I choose to merge 10 addressees at 2 pages each the last addressee gets one print out with 2 pages and a second print out with 20 pages. Bug in Word 2007? Sub PPDx2() ' ' PPDx2 Macro ' Print Page Down Macro for multiple pages ' Dim i As Long For i = 1 To ActiveDocument.Sections.Count ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i Next i End Sub On Jun 26, 8:03 am, "gcoll...(a)gmail.com" <gcoll...(a)gmail.com> wrote: > Hello, > > We have a form letter which is 2 pages. We do a mail merge from an > Excel sheet. The mail merge creates a new word document with all of > the form letters addressed to the different addressees. It appears > that Word turns each set of pages into a section. This is fine. We > then fax these to the addressees using our fax printer. I have created > a macro that prints each section as an individual document which then > gets faxed to the customer. The problem is the number of sections is a > variable. One week it may be 90 the next it may be 100. The macro I > created has 140 print sections in it. This works fine until the last > section. Because the macro has 140 sections the last fax has not only > the 2 pages it should have but then it back tracks and adds an > additional 2 pages until it gets to 140. So the last fax may have 80 > pages in it. I need the macro to understand how many sections there is > and stop when it gets to the end. > > Any advise would be great! > > Thank you.
From: Doug Robbins - Word MVP on 26 Jun 2008 17:13 I have not experienced that behaviour when using such a macro in Word 2007. However, try Dim i As Long With ActiveDocument For i = 1 to .Sections.Count .PrintOut Range:=wdPrintRangeOfPages, Pages:="s" & i Next i End With See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website at: http://www.gmayor.com/individual_merge_letters.htm If you are using Word XP or later, the "Add-in to Merge Letters to Separate Files" that I have written and that can be downloaded from that site will allow you to create each letter as a separate file with a filename taken from a field in the data source with a minimum of fuss. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP <gcollier(a)gmail.com> wrote in message news:1c913bb3-bfa7-44bd-b85d-aa342ec88dde(a)79g2000hsk.googlegroups.com... Have discovered something. I found the below macro which works great! Ehhh in Word 2000. In Word 2007 the macro prints all sections perfectly until it gets to the last one then it adds all the previous sections. So if I choose to merge 10 addressees at 2 pages each the last addressee gets one print out with 2 pages and a second print out with 20 pages. Bug in Word 2007? Sub PPDx2() ' ' PPDx2 Macro ' Print Page Down Macro for multiple pages ' Dim i As Long For i = 1 To ActiveDocument.Sections.Count ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i Next i End Sub On Jun 26, 8:03 am, "gcoll...(a)gmail.com" <gcoll...(a)gmail.com> wrote: > Hello, > > We have a form letter which is 2 pages. We do a mail merge from an > Excel sheet. The mail merge creates a new word document with all of > the form letters addressed to the different addressees. It appears > that Word turns each set of pages into a section. This is fine. We > then fax these to the addressees using our fax printer. I have created > a macro that prints each section as an individual document which then > gets faxed to the customer. The problem is the number of sections is a > variable. One week it may be 90 the next it may be 100. The macro I > created has 140 print sections in it. This works fine until the last > section. Because the macro has 140 sections the last fax has not only > the 2 pages it should have but then it back tracks and adds an > additional 2 pages until it gets to 140. So the last fax may have 80 > pages in it. I need the macro to understand how many sections there is > and stop when it gets to the end. > > Any advise would be great! > > Thank you.
|
Pages: 1 Prev: Preventing macro from copying over from template to document Next: Filtering Columns in Word? |