Can I Add a "th" suffix on a Date's Day Number?

G

Gary

I am using the Date Field in a word doc and would like to have the
"th", "rd", "st" or "nd" suffix automatically added on to the day of
the month. i.e. 1st, 2nd, 3rd, 4th... etc.

I don't have any problem getting just the day number, but I can't find
a means of getting the suffix. Also, if there is a way to do this, can
the suffix be super scripted?

TIA
 
J

John McGhie

Yes it's possible.

I need to know your version of Word and how you are entering the day number.


I am using the Date Field in a word doc and would like to have the
"th", "rd", "st" or "nd" suffix automatically added on to the day of
the month. i.e. 1st, 2nd, 3rd, 4th... etc.

I don't have any problem getting just the day number, but I can't find
a means of getting the suffix. Also, if there is a way to do this, can
the suffix be super scripted?

TIA

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
G

Gary

Yes it's possible.

I need to know your version of Word and how you are entering the day number.
I using both Mac Office 2004 and 2008.
To enter the day I used menu "Insert>Field>Date and Time>Date" with
formating DATE \@ "d"

Also, is there a way to turn off Auto updating of the field to today's
date? I would like to have the document stay at the previously entered
date until an explicit update command is issued, like pressing the F9
key (or what ever key it would be)
 
M

macropod

Hi Gary,

To see how to do this and just about everything else you might want to do with dates in Word, check out my Word Date Calculation
Tutorial, at:
http://www.wopr.com/index.php?showtopic=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Insert A Date with Ordinal Numbering'. Do read the document's introductory material.

Note: The tutorial was written for PC users, so references to Ctrl & Alt keys need to be converted to the Mac equivalents - see:
http://word.mvps.org/mac/FieldsInMacWord.html
Also, if you're using Office 2008, the vba code in the tutorial document for swapping the day & month order in the fields won't
work - you'll need to do that manually, as per the instructions in the Introduction.

As for fixing the date, you could use a CREATEDATE field instead of the DATE field.
 
G

Gary

Thanks macropod for the links, I checked out the first and D/Led the
DateCalc.zip file, but reviewing the examples has me a bit confused.

For example, when reviewing the "Insert a Date with Ordinal Numbering"
section on page 4, and right click over the field and select "Toggle
Field Codes", the doc displays "Thursday the 30th of April, 2009" as
{DATE \@ "dddd 'the 30th of' MMMM, yyyy"}. This seems to say I have to
hard code the day number, which would defeat the whole purpose of have
a DATE field.

I know I'm obviously missing something as the field generates the date
correctly as it shows today's date, but I can't get the proper code to
display so I can reproduce the formating.

What am I missing here?
 
M

macropod

Hi Gary,

The full field code is:
{DATE \@ "dddd 'the {DATE \@ d \*Ordinal} of' MMMM, yyyy"}

You simply haven't expanded all of it.
 
G

Gary

Hi Gary,

The full field code is:
{DATE \@ "dddd 'the {DATE \@ d \*Ordinal} of' MMMM, yyyy"}

You simply haven't expanded all of it.

THANK YOU! I got it working. And now that I know what to look for, I
was able to expand the superscripted version (I think). I finally
figured out that putting the mouse directly over the superscript "th"
and right-click and selecting Toggle Field Codes 3 times to get the
field to fully expand.... yowza...

Anyway, got it working exactly as I needed.

Wheww... could it be any harder??
 
M

macropod

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at the coding for some of the other fields ...
 
G

Gary

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?
 
M

macropod

Hi Gary,

I'm really not 'au fait' with Word on the Mac, so I can't really give much help beyond what I've already posted. Perhaps one of the
Word-Mac MVPs will be along soon to help ...
 
J

John McGhie

Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
M

macropod

Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among other things. On my reading, it seems when he presses F9,
only one of the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have tried to code in code in new macros using CMD-F9"), but that's
not especially important. As you say, careful attention to detail is the key.
 
G

Gary

On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among
other things. On my reading, it seems when he presses F9, only one of
the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have
tried to code in code in new macros using CMD-F9"), but that's not
especially important. As you say, careful attention to detail is the
key.

--
Cheers
macropod
[Microsoft MVP - Word]


John McGhie said:
Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers




--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
M

macropod

Hi Gary,

If all you need is a field that does as the one in my tutorial does, why aren't you simply copying & pasting the one from the
tutorial into your document?

Amongtst other things, it seems you're trying to copy & paste the field from the tutorial into a new field in your document. That
will certainly cause the kind of 'disappearing' problems you're having.

--
Cheers
macropod
[Microsoft MVP - Word]


Gary said:
On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir as I have been a programmer for IBM 13 yrs, and I very
much know the pitfalls of type-os. I've been bitten by them too many times to mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the exact Code, when I hit Opt-F9 to execute the code, the code
simply disappears: no error, no warnings, no ordinal date.... nada, white. I press Opt-F9 again and the code reappears. I also
have invisibles turned on and the end of line moves right back to the start of the line and is not displaced by a white text on
white paper.

As in the original generated code, I have verified that there is a single space after the start brace, and a single space before
the end brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it directly between the new braces, there is no
possibility of a type-o.

Although I have coded in well over 100 different language, including VB, this is my first endeavor into Word fields, and at first
sight, the syntax is straight forward, but I am having a dickens of a time implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure this out. At this point, implementing nested code is
impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among other things. On my reading, it seems when he presses F9,
only one of the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have tried to code in code in new macros using CMD-F9"), but
that's not especially important. As you say, careful attention to detail is the key.

--
Cheers
macropod
[Microsoft MVP - Word]


John McGhie said:
Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,

On 2009-05-01 00:25:53 -0600, "macropod" <[email protected]> said:

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?


--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
J

John McGhie

Hi Gary:

Well, your code worked perfectly here when I tried it.

As Macropod says, you need to be careful what you paste!

I selected everything between (but not including) your curly braces, and
pasted that into a field pair created with Cmd + F9.

Then I updated the field and I got "23rd" which is what you would expect.

Cheers


On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among
other things. On my reading, it seems when he presses F9, only one of
the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have
tried to code in code in new macros using CMD-F9"), but that's not
especially important. As you say, careful attention to detail is the
key.

--
Cheers
macropod
[Microsoft MVP - Word]


John McGhie said:
Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,

On 2009-05-01 00:25:53 -0600, "macropod" <[email protected]> said:

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?


--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
G

Gary

Hi Gary,

If all you need is a field that does as the one in my tutorial does,
why aren't you simply copying & pasting the one from the tutorial into
your document?
And there lies the rub... copying/pasting the code from the tutorial,
results in the exact same results as when I copy/paste code I
created... it simply disappears... no errors...etc.
Amongtst other things, it seems you're trying to copy & paste the field
from the tutorial into a new field in your document. That will
certainly cause the kind of 'disappearing' problems you're having.
As with my code, I selected and copied the code "between" the
outer-most braces.

This should be so simple, but I seems to be going in circles.


--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
--
Cheers
macropod
[Microsoft MVP - Word]


Gary said:
On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among
other things. On my reading, it seems when he presses F9, only one of
the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have
tried to code in code in new macros using CMD-F9"), but that's not
especially important. As you say, careful attention to detail is the
key.

--
Cheers
macropod
[Microsoft MVP - Word]


Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,

On 2009-05-01 00:25:53 -0600, "macropod" <[email protected]> said:

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?


--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
G

Gary

Hi Gary:

Well, your code worked perfectly here when I tried it.

As Macropod says, you need to be careful what you paste!

I selected everything between (but not including) your curly braces, and
pasted that into a field pair created with Cmd + F9.

Then I updated the field and I got "23rd" which is what you would expect.
Thanks John. "Updated the field" was the one step I did not have. I
just expected the field to display after inserting the code and
pressing Opt+F9, because all the existing fields were display.

I was so frustrated I could not even conceive that I would have to
update just that specific field.

Finally, I can stop loosing sleep over this!

MANY Thanks got to both you and macropod for your patience and help.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Cheers


On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among
other things. On my reading, it seems when he presses F9, only one of
the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have
tried to code in code in new macros using CMD-F9"), but that's not
especially important. As you say, careful attention to detail is the
key.

--
Cheers
macropod
[Microsoft MVP - Word]


Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,

On 2009-05-01 00:25:53 -0600, "macropod" <[email protected]> said:

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?


--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
J

John McGhie

Hi Gary:

Well, I'm glad you got it sorted :)

Word has three kinds of field: "Hot", "Warm", and "Cold".

A Hot field updates instantly and automatically. AutoNum and Page are
frequently-used examples.

A Warm field updates only at defined document events, such as "Open". Most
of the Date fields are like this: if you leave a document open overnight,
the date will not change unless you reopen the document.

A Cold field updates only when you update it. Most fields are like this:
TOC, Index, Document Properties...

No, sorry, there's no documentation anywhere to tell you which is which...

Cheers

Hi Gary:

Well, your code worked perfectly here when I tried it.

As Macropod says, you need to be careful what you paste!

I selected everything between (but not including) your curly braces, and
pasted that into a field pair created with Cmd + F9.

Then I updated the field and I got "23rd" which is what you would expect.
Thanks John. "Updated the field" was the one step I did not have. I
just expected the field to display after inserting the code and
pressing Opt+F9, because all the existing fields were display.

I was so frustrated I could not even conceive that I would have to
update just that specific field.

Finally, I can stop loosing sleep over this!

MANY Thanks got to both you and macropod for your patience and help.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada
Cheers


On 2009-05-09 02:14:12 -0600, "macropod" <[email protected]> said:

OK, Back late to the party...

Thanks for chiming in John. Believe me, you are preaching to the choir
as I have been a programmer for IBM 13 yrs, and I very much know the
pitfalls of type-os. I've been bitten by them too many times to
mention, But that is not the problem here.

When I generate the macro using insert field and get the pop-up window
to create an ordinal date, the following code is generated:
{ CREATEDATE \@ d \*Ordinal \* MERGEFORMAT }

However, if I use CMD-F9 to create a field and enter (copy/paste) the
exact Code, when I hit Opt-F9 to execute the code, the code simply
disappears: no error, no warnings, no ordinal date.... nada, white. I
press Opt-F9 again and the code reappears. I also have invisibles
turned on and the end of line moves right back to the start of the line
and is not displaced by a white text on white paper.

As in the original generated code, I have verified that there is a
single space after the start brace, and a single space before the end
brace. Since I copied (CMD-C) the generated code and pasted (CMD-V) it
directly between the new braces, there is no possibility of a type-o.

Although I have coded in well over 100 different language, including
VB, this is my first endeavor into Word fields, and at first sight, the
syntax is straight forward, but I am having a dickens of a time
implementing any code that is NOT generated by Word.

I really appreciate both of your time and patience helping me figure
this out. At this point, implementing nested code is impossible.

--
Thanks
Gary at thumbprints dot ca
Edmonton, Alberta, Canada

Hi John,

Thanks for joining the discussion.

I believe the OP is having problems getting the fields to update, among
other things. On my reading, it seems when he presses F9, only one of
the fields in a set of nested fields updates.

Like many Word users, the OP believes fields are macros (cf "I have
tried to code in code in new macros using CMD-F9"), but that's not
especially important. As you say, careful attention to detail is the
key.

--
Cheers
macropod
[Microsoft MVP - Word]


Hi Gary:

There's no "Trick" to it, other than "type carefully" :)

You are writing computer code. Admittedly, it's simple code, but the
computer ain't that smart. The spelling is critical,
character-for-character, and the spaces or absence of spaces are all
important.

And you must pay attention to the "matching" or "nesting" of the various
sets of Field Bounding Characters (which, as you correctly point out, are
'not' curly brackets).

However, if Word does not "recognise" the code, it will normally return an
error message when you update the field.

So you need to show us the code you are typing, and maybe we can help.

Cheers


On 8/05/09 9:06 PM, in article 2009050805064316807-gary@NOSPAMinvalid,

On 2009-05-01 00:25:53 -0600, "macropod" <[email protected]> said:

Hi Gary,

If you think that's a challenge, try pressing Option-F9 and looking at
the coding for some of the other fields ...

Thanks macropod, I tried the Opt-F9 and now think that my head might
explode!!! :)

I have tried to code in new macros using CMD-F9 so that the funky curly
brackets are inserted and added code in between the bracket, but I
can't get anything to work, even if I cut and past from the example.
The only way I could get the code to work is if I use the menu command
for Insert Field, which is fine for single level macros, but won't work
at all for nested macros like your example. I ended up just having a
field for just the month, another field for the ordinal day, and a 3rd
for the year.

Is there a trick to getting word to recognize the nested field code or
am I just missing something obvious, except to me?


--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top