Variable fields

J

Jack_Feeman

Word 2003.

I have avoided using a field like "Today's Date" because when you open the
document a month from now it puts that date in its place so it shows no
history. I want to do the following in a Word Form.
• Auto populate the document number in the format of 000-07 where 000 is the
auto-incremented integer maintained in 3-digit format; - is the separator;
and 07 is the current 2-digit year. The number must become static once it is
added to the document so that if this document is opened in 2008 the number
does not automatically update to 2008.

Thanks
Jack
 
J

Jay Freedman

Use the macro in http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm to
create the three-digit document number. Modify the ActiveDocument.Bookmarks
line near the end of the macro as follows to add the separator and year
number:

ActiveDocument.Bookmarks("Order").Range.InsertBefore _
Format(Order, "00#") & "-" & Format(Now, "YY")

This will be inserted as plain text, so it won't update later. (Note: be
careful to include a space before the line-ending underscore.)

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jack_Feeman

Jay,

Works great only I did like it said and made it an AutoNew() macro but it
does not run automatically when the document is created. It works fine if I
run the macro from the macro menu.

How do I get it to autorun when I created a new document from the template.
Thanks again
Jack
 

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