View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill
 
Posts: n/a
Default Need help with Field Codes

No need for a QUOTE field. This works just fine for me (Word 2003) with this
syntax:

{ = { DATE \@ "YYYY" } +1 }

Note the spaces.


--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Rhino" wrote in message
...
I'm trying to put a field code into my Word 2002 document but having

trouble
getting the syntax just right.

I want the field code to be replaced by the current year plus 1.

Therefore,
if the document is being generated today, I want the field code to put

2007
at a specifc place within my document.

I know that the field code {DATE \@ "YYYY"} will give me the current year.

I'm struggling with how to write the field code that will give me the next
year. First of all, I'm not sure whether I can write an expression that

adds
1 to year and display that result directly or whether I have to first
transform that result to a character string. Second, I'm not sure how to

get
the result even as an integer.

To get an integer result, I'm guessing that I have to use an = formula,
something like this:

{={DATE \@ "YYYY"}+1}

To get a character string result, I'm guessing that I have to imbed all of
that in a QUOTE, something like this:

{QUOTE "{={DATE \@ "YYYY"} +1}/1 \@ "YYYY"}

This last guess was inspired by the Help article on QUOTE.

Unfortunately, I inevitably get a Syntax Error whenever I try to use

either
approach, no matter how carefully I try to write the field code. (I'm a
veteran programmer and I know how important it is to get the syntax of a
statement just right.) What's worse is that everytime I get the Syntax
Error, the original field code is destroyed and I have to painstakingly

type
it all in again rather than just altering it and trying it again.

Can anyone help me out?

--
Rhino