Word question about Macros ---- I think!

M

marf

Problem Decription:

I have a word 2003 doc that is hundreds of pages long. It is a manual for a
program that my company runs every couple of years. The program is a
structured 12 month program where the participant has to follow a monthly
plan. See below:

Month 1
monthly plan, worksheets, readings, exercices, etc.

Month 2
monthly plan, worksheets, readings, exercices, etc.
..
..
..
Month 12
monthly plan, worksheets, readings, exercices, etc.

The program never starts the same month every time is offered. So for
example, this year month 1 is August, month 2 is Sept, etc.

The person in charge of the program always misses a month here and there
when she updates which causes confusion to the participants.

I would like to write a macro, where all I would have to do would be to plug
in the start month and have it update every instance of the month (staggered
by the right amount) throughtout the document. Is that possible??
 
P

Peter Jamieson

It might be easier to do this as follows:
a. put the following fields at the beginning of your document (use ctrl-F9
to insert every pair of Special field code braces { }, and use Alt-F9 to
show/hide your field codes)

{ SET StartMonthNumber 3 }{ SEQ mnum \r{ =MOD(12-{ REF
StartMonthNumber },12 } \h }{ SEQ mname \r0 \h }

Put a second set of fields immediately afterwards (no paragraph marks!)

{ SET "m{ = MOD({ SEQ mnum },12)+1 }" { QUOTE 2008-{ SEQ mname }-01
\@MMMM } }

Copy the second set of fields 11 times (so that there are 12 sets
altogether). No paragraph marks!

Select them all and press F9 to re-execute them

Everywhere you need a month number 1, use the field code { m1 } ( or { REF
m1 } instead. As things stand, { m1 } should evaluate to "March"

When you do the next year's plan,
a. use Alt-F9 to reveal the field codes
b. change the "3" in the first field to be the number of your start month,
e.g. if month 1 should be August, set it to 8
c. Use Alt-F9 to hide the field codes
d. select the document and press F9.

If you use the month numbers in headers/footers or other things that are not
in the "main text stream" of the document, you may need a small macro that
updates fields everywhere in the document/

Now all you have to do is locate all the places where someone has entered a
month number directly, rather than using { m<monthnumber> }. But I think you
will have that particular problem whatever you do.

There are other approaches that work along similar lines that you could use,
but I think this one is not a bad combination from an ease of creation and
use point of view.
 

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