#  Other Applications & Softwares  > Word Formatting & General >  >  Footer with Field Codes

## emmetje

Hi everybody,

I created a document with 2 footers, 1 left and one right of the document. 

In the left footer I created the following code: 

{ = { SECTIONPAGES } - { PAGE } \# " 'Initials:';;" }

This way my document shows no footer if it only consists of 1 page and a footer on each page other then the last page if it consists of multiple pages. I specifically chose this code instead of the IF code because I need to merge the document, so IF codes are no good.

In the right footer I created the following code: 

{ = { SECTIONPAGES } + { PAGE } \# " 'Page {PAGE} of {NUMPAGES}';;" }

I did this because other then the left footer, I need the right footer to show on the last page if the document consists of multiple pages. 
The only thing is, that I do not want the right footer to show if the document consists of 1 page, just like I do with the left footer. 

Any suggestions on how to adjust the code in order to get the right footer work the way I want it to? 

So, resuming: 

Document has only 1 page: no left footer and no right footer
Document has more then 1 page: left footer on every page other then the last page and right footer on every page

Thanks in advance!

----------


## macropod

Try:
{=({SECTIONPAGES}=1) \# ";;'Page {PAGE} of {NUMPAGES}'"}

----------


## emmetje

Thanks!  :Smilie:

----------


## emmetje

Sorry, still got a little problem. I use this document to create letters to our customers. Sometimes I select only 1 customer to merge and sometimes multiple customers. In a 2 page letter, if I select only 1 customer, the code you wrote works just fine. But if I select 2 customers I get the following: 
Customer 1, first page: Page 1 of 4
Customer 1, second page: Page 2 of 4
Customer 2, first page: Page 1 of 4
Customer 2, second page: Page 2 of 4
In a 1 page letter the code works fine on all selections. 

Any idea how to resolve the page issue on multiple merge selections?

----------


## macropod

Change 'NUMPAGES' to 'SECTIONPAGES'

----------


## mubashir aziz

Sorry guys actually this was the code which i was looking for but unfortunately its not working on my side  :Frown:  and giving this error *!Syntax Error, {* in both codes ....
I"ll be much appreciated if you attach the sample file. 
I"m inserting code in field by clicing Ctrl + F9 in footer.

----------


## macropod

Depending on your regional settings, you may need to use:
{=({SECTIONPAGES}=1) \# ",,'Page {PAGE} of {SECTIONPAGES}'"}

----------


## mubashir aziz

> Depending on your regional settings, you may need to use:
> {=({SECTIONPAGES}=1) \# ",,'Page {PAGE} of {SECTIONPAGES}'"}




I've treid all but all in vain. I'm attaching the file that may be i'm wrongly inputting these formula's .......

----------


## macropod

You document has only the outer set of field braces - the others, which should also be field braces, are only ordinary braces.

----------


## mubashir aziz

it seems i'm missing something. Does these braces come like we do ctr+shift+enter in Excel to perform some array formulas? 
sorry I think i really don't know how to enter this code  :Frown:  can you explain further please ...

----------


## mubashir aziz

I've tried and insert curely bracket {} by pressing Ctrl+f9 and then write page number inside now by toggeling this field I've got this {=(3=1)\#",,'page 1 of 3'"} but now this error coming   !Syntax Error, )
How can i insert () thru fields ?

----------


## macropod

The '()' are just ordinary parentheses, not field braces. Since you're syntax error was originally because you weren't using the field braces properly, your regional settings my not need the alternate syntax I suggested. In that case, use the original one:
{=({SECTIONPAGES}=1) \# ";;'Page {PAGE} of {SECTIONPAGES}'"}

----------


## emmetje

Hi macropod,

Thank you so much for helping me out. Off course I should have known that I had to change numpages into sectionpages...  :Wink:

----------


## emmetje

mubashir aziz,

If you still get the syntax error try the following: press 4x in a row CTRL-F9 so that you get all the braces you need and then type the syntax within the braces like mentioned above. This should work.  :Smilie:

----------


## macropod

> If you still get the syntax error try the following: press 4x in a row CTRL-F9 so that you get all the braces you need and then type the syntax within the braces like mentioned above. This should work.



You need to be a bit more sophisticated than that - your suggestion will produce a set a nested field braces thus {{{{}}}}, whereas what you need is {{}{}{}}.

----------


## James Donovan

> Change 'NUMPAGES' to 'SECTIONPAGES'



Agreed........with you.....

----------

