![]() |
#1
|
|||
|
|||
![]()
please help!
For printing reasons, I need my word documents to 1) check the number of pages 2) if the number of pages is a multiple of 4, insert a blank sheet at the end of the document. Is this possible? Thanks in advance. |
#2
|
||||
|
||||
![]()
Hi Samantha,
You don't need a macro. You can use a formula field coded as: {IF{=MOD({PAGE},4)}= 0 {QUOTE 12}} Simply place the field before the final paragraph mark on the document's last page Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Fantastic - thank you so much.
I'm having a problem though - I do not know how to insert a formula field. I'm trying through INSERT>FIELD then copying the fomula under the IF section (Deleting the IF from there first, and deleting the {} from the edge of the code. I can't just get it to work. Any advice? Thanks |
#4
|
||||
|
||||
![]()
Hi Smantha,
As noted in my previous post: Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Apologies - I didn't explain very well.
I have tried using ctrl+F9 in the insert field box. This does not work. So I have done it straight into the document. I have tried every combination of Making the outside {}first, then doing ctrl+f9 for the inside {} as well. Deleting the spaces, etc. I get the error (Upon right click and 'update field') Error! Unkown op code for conditional. I have never worked with fields before I'm afraid, but I am using ctrl+f9 for the {} as specified. I am so happy to know this can be done, but am just struggling to get there ![]() Last edited by samanthaj; 01-19-2012 at 04:40 AM. Reason: (my own stupidity) |
#6
|
||||
|
||||
![]()
Hi Smantha,
The Ctrl-F9 is done in the document, not in the Insert|Fields dialogue box.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
That is what I have been doing.
I am still getting the above error though. |
#8
|
||||
|
||||
![]()
Hi Smantha,
See the attached. The document presently has only one page. Pressing Alt-F9 toggles the field code display on/off.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
Ok - that is great.
I think, therefore, that my problem lies in the working of fields. How do I make it 'work'? For example - if my document has 8 pages - how does this field code add in the extra page? Because currently nothing happens. I know I'm missing something very obvious and I really appreciate your time in helping me. |
#10
|
||||
|
||||
![]()
Hi Samantha,
To make the field 'work', there's only two things you'll need to do: • Place the field before the final paragraph mark on the document's last page; and • Make sure Word's 'update fields' option is checked under Tools|Options|Print. If, at print time, your document a multiple of four pages (per your specs), the field will insert a page break and, hence, start a new page at that point. Conversely, the field will delete that break if these conditions aren't met.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
![]()
It works!! Thank you so much! I hadn't got update in tools selected.
Each of my documents will have a different number of pages. For documents of either 7 or 11 pages - I need to insert 2 pages. I've tried playing around with the coding (QUOTE 12 is page break I think?) but can't quite get there. Can you have multiple conditions within one code? |
#12
|
||||
|
||||
![]()
Hi Samantha,
If I understand your requirements correctly, you need something like: {IF{=MOD({PAGE},4)}= 2 {QUOTE 12 12 12} {IF{=MOD({PAGE},4)}= 3 {QUOTE 12 12} {IF{=MOD({PAGE},4)}= 0 {QUOTE 12}}}} See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
![]()
Thank you so much - that works beautifully macropod.
I have hit another problem though. The program I am merging from is set up with 40 pages originally. When I merge, it only merges the relevant pages for each case - usually between 8 - 14 but some anomalies. The program doesn't even look at the pages it is not going to merge. So of course, when I paste this code at the end of the document, unless the last page is included in the merge, it is completely ignored. I have thought of a couple of possibilities. Could this be placed in the footer? But if it is, will it be read and acted upon on every page, or just the last page? My other thought is to add another page at the end of the document - something generic - for example the company logo for the back page of the document which would be then merged in every instance. This solves the problem of the code not being merged, but it means the pages would need to be inserted before that final page, rather than after. And from what I see QUOTE 12 is to insert a page break - so is there an equivalent QUOTE which will do the opposite? (I have a feeling not?) I really do apperciate all the time you have put in to helping me macropod - I really don't know where we'd be without your help! |
#14
|
||||
|
||||
![]()
Hi Samantha,
This the first mention you've made of merging. Is this a mailmerge, or something else? Since a document always has a last page, whatever you're adding to the document needs to be on or before that page - and always before the field code. Some more detail about the process wouldn't go astray ... And no, there isn't a field code for removing an existing page break.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
![]()
I'm sorry - I was rather vague wasn't I?!
It is for student reports. The system is set up for every eventuality of reports and subjects. Of course not all students study each subject. So the merge only merges the relevant subjects for each student. The subjects are alphabetically arranged - one page per subject. So not every student studies World Politics (the last subject in order), so it is not merged for every report. So if I put the coding at the bottom of that page - the merge will completely ignore the page. Considering the above, the last page is always present - but it varies between reports. So I cannot place it in a place which will be consistant. Of course I could move a generic report to the back, for example mathematics, which all students study, but it would be unusual to have a principal subject at the end and my managers are keen to avoid that. It is a mail merge, but not from a microsoft product. |
![]() |
|
![]() |
||||
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 |