Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Automatically Inserting Tomorrow's Date.

Automatically Inserting Tomorrow's Date

by Allen Wyatt
(last updated May 22, 2015)

2

Let's say that you work for a company and that your job is to prepare reports or press releases that will be distributed the next day. On every one of these documents you need to make sure that tomorrow's date appears. After doing this for a while, you may start searching about for a way to automatically insert tomorrow's date into a new document. It would be even better if this automatic feature could be included as part of a template. Thus, when you create a new document based on the template, it automatically has tomorrow's date in the proper place.

Your first inclination might be to simply change the system date that is on your computer. If you increase the system date by one day, then by being out of kilter with the rest of the world by one day, you can easily insert the date you need. While this would do the job, it will definitely affect all other uses of the date on that system, as well.

There is a relatively easy solution within Word, however. The following macro, when saved in the template using the name AutoNew, replaces a bookmark called MyDate with tomorrow's date. The cool thing about the macro is that it doesn't just insert a date at the beginning of the file, but gives you control over the exact placement anywhere within the file.

Sub AutoNew()
    With ActiveDocument.Bookmarks("MyDate").Range
        .InsertBefore Format(Date + 1, "dd mmmm yyyy")
    End With
End Sub

The format in which the date appears can be modified by altering the "dd mmmm yyyy" string to achieve the desired format. More information on format strings is available in the online VBA documentation.

To use the macro, all you need to do is make sure that the template includes some text that is bookmarked using the name MyDate. Save the template, and then any new documents you create based on that template will automatically include tomorrow's date in place of the bookmark.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1312) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Automatically Inserting Tomorrow's Date.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

No-border Text Boxes by Default

Text boxes can be a great design element when laying out your documents. If you want those text boxes to have no borders (or ...

Discover More

Calculating TV Time

In some industries it is necessary to work with time resolutions of less than a second. If you need to keep track of such ...

Discover More

Multiple Pages Per Sheet

You can save on paper with your printouts by instructing Word to print multiple pages on a single sheet. In fact, you can put ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Numbers to Text, Take Three (Over a Million)

So, you need to convert a number to text that is over one million? Here is a VBA macro that will convert up to 999,999,999.

Discover More

Extracting INCLUDEPICTURE File Names

If you use the INCLUDEPICTURE field to add images to your document, you may love the macro in this tip. It allows you to pull ...

Discover More

Getting User Input in a Dialog Box

Want to grab some interactive input from a user in your macro? The best way to do that is with the InputBox function, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 2?

2016-03-04 06:16:47

Don Farrell

Finally got it working.

I needed to populate the next day's date in 5 different places across a 14 page legal sized document.

To get it to work properly, I had to create 5 unique bookmarks, then create the macro to go to each bookmark and populate the date.

Here is the macro:

Sub NewDate()
With ActiveDocument.Bookmarks("MyDate1").Range
.InsertBefore Format(Date + 1, "mm/dd/yyyy")
End With
With ActiveDocument.Bookmarks("MyDate2").Range
.InsertBefore Format(Date + 1, "mm/dd/yyyy")
End With
With ActiveDocument.Bookmarks("MyDate3").Range
.InsertBefore Format(Date + 1, "mm/dd/yyyy")
End With
With ActiveDocument.Bookmarks("MyDate4").Range
.InsertBefore Format(Date + 1, "mm/dd/yyyy")
End With
With ActiveDocument.Bookmarks("MyDate5").Range
.InsertBefore Format(Date + 1, "mm/dd/yyyy")
End With
End Sub

The AutoOpen did not work in my case because if the template had to be updated and saved, it was saved with the populated dates which caused problems the next time the template was opened.

So I named the macro "NewDate" per a previous Wordtip. Now the template can be opened and edited without engaging the macro and when needed the macro can be "run".

I still need to figure out how to set the font to Times-Roman, bold, underline, can anyone help me with that, please?


2015-02-07 04:21:30

Chris W

Hi Allen,
Thanks for the tips here; I needed to add dates for the next 4 days in a forecast form and your instruction was very useful.
I ended up saving the macro in this file only and calling it "AutoOpen" so that the dates are inserted as soon as the file is opened; then when saving the user saves using the same filename with a date added to the end (_ddmmyy).
Thanks for the info!.
Rgds, Chris.


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.