Re: Need help with Field Codes
- From: "Rhino" <no.offline.contact.please@xxxxxxxxxx>
- Date: Sat, 17 Jun 2006 09:16:58 -0400
"Graham Mayor" <gmayor@xxxxxxxx> wrote in message
news:uq7dIAdkGHA.1456@xxxxxxxxxxxxxxxxxxxxxxx
I'm not sure what Suzanne is thinking of here, but date and calculationOkay, now I'm officially baffled. :-)
fields do work in mail merge.
You need CTRL+F9 for *each pair* of curly brackets and you need to end up
with the following
{ ={ DATE \@ "yyyy" } +1 } which currently will give you 2007. Press F9 to
update the field.
I tried your suggestion just now and it worked perfectly. I even tried
changing the date on my computer, closed and reopened the document and found
that the current year and the current year plus 1 were exactly as I wanted
them to be.
The reason I'm baffled is that I tried the same formula - and umpteen
variations - yesterday and none of them worked correctly: they either gave
me an error of some kind or they inevitably showed the current year, not the
current year plus 1. I was getting REALLY frustrated by that experience and
now everything works just as cleanly and simply as I had expected when I
started playing with this formula. I'm completely at a loss to understand
why none of this was working yesterday despite several hours of
experimentation and now works perfectly today.
Do you or Suzanne have any idea what the problem might have been yesterday?
I have to believe that there is a rational explanation for this so I find
myself wondering what it is.
My guess is that the technique I used for entering the formula was flawed in
some way. I tried entering the formula in several different ways yesterday:
1. I cut and pasted the formula, except for the outermost braces, directly
into my document, specifically in the top left hand label. Then I selected
the formula and hit CTRL-F9.
2. I positioned the insert point at the appropriate spot in the document,
hit CTRL-F9, typed the = sign, hit CTRL-F9 again, typed the DATE \@ "yyyy"
portion of the formula, moved my cursor past the inner closing brace, then
typed +1 between the two closing braces.
3. I positioned the insert point at the appropriate spot in the document,
clicked Insert/Field, selected = Formula, entered {DATE \@ "yyyy"}+1 in the
formula field, clicked OK.
Should all of these techniques work in Word 2002?
Today, I used the second approach and it worked perfectly, as I said. But
I'm sure I did the same thing, probably several times, yesterday and it did
NOT work then.
For more complex date calculations, seeI had a look at your links and found that the first one refers to the
http://www.gmayor.com/insert_a_date_other_than_today.htm and for
formatting, see http://www.gmayor.com/formatting_word_fields.htm
Macropod article on advanced date handling. I found that yesterday via
Google newsgroups and downloaded his demonstration document. I was using it
to compute the next year but his formulas weren't working for me either,
despite typing them meticulously. Now that I appear to be out of the
Twilight Zone, I may give those another try, just to verify that they work
as Macropod describes.
The formallting article was also interesting and I may use some of those
techniques in future documents, just as I used another of your articles to
learn how to do mail merges earlier in the week.
You've done a great job with your website! Thank you for taking the time to
share your knowledge with those of us who are new to Word and still
struggling a bit with some aspects of the product!
--
Rhino
Rhino wrote:
So you're saying that there's no way to put the current year plus 1
(whatever the current year is when I run the mail merge) in each
label of a set of labels? No way at all?? Are you sure?
I find that surprising: Word seems pretty powerful and the task of
putting a date on each label seems pretty trivial. By the way, I can
put the current date on a label easily enough, it's just the result
of adding 1 to the current year that is giving me trouble.
Considering that you can calculate quantities like the current year
plus 1 in other places within the document, why not do the same in a
mail merge?
By the way, I was able to get past the Syntax Error problem I reported
earlier. I now have perfectly valid looking code that doesn't give me
an error message:
{ DATE = {={DATE \@ yyyy} + 1}}
However, although the expression seems to be calculating the current
year plus 1, the result of the calculation always seems to be the
current year NOT the current year plus 1. For what it's worth, I have
tried umpteen variations of this formula, some of which used
CREATEDATE instead of DATE and some of which used "yyyy" instead of
yyyy, but I always get the current year, not current year plus 1.
I've tried adding numbers much greater than 1 - on the theory that 1
might have been interpreted as 1 millisecond instead of 1 year in
this expression - but even with huge numbers like 99999999999999999,
the result of the addition is always the current year.
"Suzanne S. Barnhill" <sbarnhill@xxxxxxxx> wrote in message
news:e3LCrIbkGHA.2280@xxxxxxxxxxxxxxxxxxxxxxx
You did not mention a mail merge. Date fields are not compatible
with mail merges.
--
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" <no.offline.contact.please@xxxxxxxxxx> wrote in message
news:%23qqrfjakGHA.4504@xxxxxxxxxxxxxxxxxxxxxxx
There's got to be some kind of a knack that I'm just not getting
here. I tried doing a CTRL-F9 to produce a pair of heavy braces at the
right point in my document. That worked. Then, when I pasted the
exact string you provided in your note, including the spaces, that
seemed to work too. But as soon as I pressed the "Propagate" icon
on the Mail Merge toolbar, the spot
where I had entered the field code said !Syntax Error, {.
<VENT>
I've been messing with this seemingly simple task of inputting a
formula for calculating the next year for something like two hours
and my head's getting sore from banging it on the wall. I seem to
have tried every variation I can imagine of DATE, SET, =, and
everything else I could think of and it inevitably gets me a syntax
error!! What the heck is going on here?? I've done a Google search
on the newsgroup and seen several variations of your suggestion
supplied by various responders and none of them seem to have any
followup questions, which gives the impression that the original
poster had no problem using this formula in their documents. So why
do I alone seem to have problems with this?? Is there some kind of
document wide setting that has the wrong value or something??
</VENT>
For what it's worth, I've also tried doing Insert/Field, selecting
=, then
entering { DATE \@ "YYYY" } +1
in the Formula field, then choosing 0 as the number format. That
doesn't work either. I've tried using lowercase "yyyy" instead of
"YYYY". That didn't help. Everything leads me back to this Syntax
Error. What boneheaded mistake am I making here?
--
Rhino
"Suzanne S. Barnhill" <sbarnhill@xxxxxxxx> wrote in message
news:%23JjcJOakGHA.1324@xxxxxxxxxxxxxxxxxxxxxxx
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" <no.offline.contact.please@xxxxxxxxxx> wrote in message
news:urbnKtZkGHA.4828@xxxxxxxxxxxxxxxxxxxxxxx
I'm trying to put a field code into my Word 2002 document butadds
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
1 to year and display that result directly or whether I have totype
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
it all in again rather than just altering it and trying it again.
Can anyone help me out?
--
Rhino
.
- Follow-Ups:
- Re: Need help with Field Codes
- From: Charles Kenyon
- Re: Need help with Field Codes
- From: aalaan
- Re: Need help with Field Codes
- From: Graham Mayor
- Re: Need help with Field Codes
- References:
- Need help with Field Codes
- From: Rhino
- Re: Need help with Field Codes
- From: Suzanne S. Barnhill
- Re: Need help with Field Codes
- From: Rhino
- Re: Need help with Field Codes
- From: Suzanne S. Barnhill
- Re: Need help with Field Codes
- From: Rhino
- Re: Need help with Field Codes
- From: Graham Mayor
- Need help with Field Codes
- Prev by Date: Re: FrameMaker convert to Word?
- Next by Date: Basic Question about Comments
- Previous by thread: Re: Need help with Field Codes
- Next by thread: Re: Need help with Field Codes
- Index(es):
Relevant Pages
|
Loading