13
4
I'm trying to use the following as a field in word:
{ = { NumPages } - 1 }
And I get the following error:
!Syntax Error, {
I seem to be using the right format per Microsoft. Any ideas? Thanks as always.
13
4
I'm trying to use the following as a field in word:
{ = { NumPages } - 1 }
And I get the following error:
!Syntax Error, {
I seem to be using the right format per Microsoft. Any ideas? Thanks as always.
21
The following are the steps that you will have to follow to do what you are after:
{NUMPAGES}
field including the {
and }
Press Ctrl+F9 - this will place a pair of braces {
}
around the
NUMPAGES field so that it now looks like:
{ {NUMPAGES} }
Between the { {, insert an = sign, and between the } } insert -1 so that the field now looks like:
{={NUMPAGES}-1}
Now press Alt+F9 to hide the field codes and select the field, which will still probably shown the total number of pages and press F9 to update the fields. You should now have the result that you are after.
Previewing the document will also update the fields as will printing it if the Update Fields
box is checked under the Tools>Options>Print
menu item (newer versions will put it in File>Options>Display
).
The main thing to remember when working with fields is that you must use Ctrl+F9 to insert a pair of {
}
. Typing them in from the keyboard does not work.
I'm still getting the syntax error message. See my code in the original answer - it is identical to your code. Thanks for taking the time to answer. – Mark Williams – 2014-09-28T11:37:28.850
1It may look the same but if you don't follow these instructions to the letter it is not the same. I've tested this myself and I assure you that it is correct. – krowe – 2014-09-28T11:49:48.773
Thanks, @krowe! I confirm that your instructions work. The main thing to remember part, about using Ctrl+F9 to insert curly braces, is what did the trick for me. – georgebrindeiro – 2018-04-06T20:42:04.797
@krowe, I followed your instruction, but at last returns !Invalid Character Setting. – mgae2m – 2019-01-14T04:01:21.440
@mgae2m If it says that then it means that you did NOT follow my instructions. This is why I told you to be careful and follow the instructions as they are written; not as you expect them to be. – krowe – 2019-01-14T05:52:04.343