View Single Post
  #1   Report Post  
Posted to microsoft.public.word.newusers
Rhino
 
Posts: n/a
Default Need help with Field Codes

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