3

I would like to learn how to display the name of the month before the current month in a Word 2003 document. I have tried over and over again to follow the instructions I found on the link below, but no matter what I try I get one of several errors, something about syntax or picture switches that I don't understand. I have tried searching and I think I just don't know how to actually put the code into MS Word. Would anyone be willing to help me take this code from your forum and enter it into my document?

Thank you!

How do I display the next month in a Microsoft Word field?

Community
  • 1
  • 1
Christa
  • 31
  • 1
  • 2

1 Answers1

9

The trouble with field coding is that there are a number of locale-related dependencies. That is one possible reason why you have been unable to make the suggestions in the links you mention work. Another reason is that one suggestion there cannot possibly have worked :-)

I suggest that you try to insert the following nested field in your document, and see if that works:

{ QUOTE "2013-{ = { DATE \@M } - 1 \#00;;'12' }-01" \@MMMM }

Some notes: - use ctrl-F9 to insert a pair of the special field code braces {} (you can't just type them on the keyboard) - you can toggle between "field code view" and "field result view" using alt-F9. You may need to do that as you proceed - these fields will not automatically update. To ensure that the result is for the current date, select the nested field and click F9

To insert the nested field: - click F9. You should see { }

  • click between the braces, and type QUOTE "2013--01" \@MMMM

so you see { QUOTE "2013--01" \@MMMM }

click between the two "--" and click ctrl-F9 again so you see { QUOTE "2013-{ }-01" \@MMMM }

click between the new { } and type = - 1 \#0;;'12'

so you see { QUOTE "2013-{ = - 1 \#00;;'12' }-01" \@MMMM }

click after the ' = ' and click ctrl-F9 again so you see { QUOTE "2013-{ = { } - 1 \#0;;'12' }-01" \@MMMM }

click between the new { } and type DATE \@M

so you see { QUOTE "2013-{ = { DATE \@M } - 1 \#00;;'12' }-01" \@MMMM }

Then select the nested field, clcik F9,and click alt-F9 as necessary to display the result.

This approach probably differs from what you have seen before because

  • it doesn't use a nested IF to generate the correct month
  • it uses a YYYY-MM-DD format to generate a date that can be used to extract the month name. That's because using formats such as DD/MM/YYYY depend on the locale (i.e. they may work if the date format is DD/MM/YYYY but not if it's MM/DD/YYYY. As far as I know, YYYY-MM-DD is either locale-independent, or as locale-independent as it gets.
  • Thank you SO much for trying to help me out, and giving me such awesome step-by-step instructions! I think I understand a little better how this stuff works, but I tried doing everything just like you said and I still cannot get it to work... It is giving me a syntax error and looks like this when I'm done: "2013-!Syntax Error, #-01". I even tried applying what I learned to putting in the one in the above link, and ended up with "1.Error! Unknown op code for conditional..2013". Both of these error messages are still improvements on the ones I got before though... Thank you so much though! – Christa Apr 03 '13 at 15:54
  • I was able to use this in two different mail merges I've got, tweaking the format for what I need, and now I don't have to worry about forgetting to change it every time I mail merge!!! So thanks again, I'm so excited I learned something new!! =D – Christa Apr 11 '13 at 21:36