![]() |
#16
|
||||
|
||||
![]()
Hi Samantha,
When you say "It is a mail merge, but not from a microsoft product", does Word do the mailmerge, or are you just getting a document generated by your application that Word can open? It makes a huge difference. Assuming Word is doing the mailmerge, you're probably using either a letter merge or a Directory/Catalog merge. With a letter mailmerge, what ordinarily happens is that you get a document with one page per record, with 'Next Page' Section breaks separating the pages. To list all the records for each student sequentially, they'd need to be sorted or a sort applied as part of the mailmerge process. A Directory/Catalog merge, on the other hand, can output page breaks between the records. In either case, if you want to insert a number of blank pages between the sets of records for each student, there are two problems that have to be addressed: 1. Identifying when the students change (eg different student IDs); and 2. Calculating how many blank pages to insert. With a mailmerge, you can't do that using IF fields at all, since IF fields get converted to their results at the time of the merge - which is liable to mean either no output or the same potentially wrong output from them at all. Furthermore, if you're using a letter merge, the page count returned by the field code will typically be '1', since whatever Section the field is in is liable to have only 1 page ... I know how to deal with both issues, but I'd need to know just how your merge is being done before getting into those issues.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
![]()
The file is generated through the program and opened in Word. Although, I believe it to be an .xml file, not .doc.
Thanks again macropod - we really appreciate your help, advice and time. |
#18
|
||||
|
||||
![]()
Hi Samantha,
OK, maybe trying to build the logic into the documents themselves isn't going to work. Here's a macro you can try instead. Add it to Word's 'Normal' template and it'll be available to run on any document. Code:
Sub Mod4Pages() With ActiveDocument While .Range.ComputeStatistics(wdStatisticPages) Mod 4 <> 0 .Range.InsertAfter Chr(12) Wend End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Insert Text Into Cells Having Multiple Lines | revans611 | Excel Programming | 4 | 10-24-2011 10:15 AM |
VBA: Recording a macro to insert a PIVOT table | e093223 | Excel Programming | 0 | 10-09-2011 01:55 AM |
Powerpoint Macro To Insert Objects Sample | lahuva | PowerPoint | 0 | 07-06-2011 10:51 AM |
Insert Page Error | nmbrown | Word | 1 | 10-28-2010 10:33 AM |
![]() |
rfhall50 | Word VBA | 2 | 10-25-2010 12:41 PM |