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

Automatically Inserting Tomorrow's Date

by Allen Wyatt
(last updated June 8, 2015)

8

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 (10838) applies to Microsoft Word 2007 and 2010. You can find a version of this tip for the older menu interface of Word 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

Initiating a New Search

I do a lot of searching in my documents. Sometimes the searches may not go exactly as I expected. Here are some things I ...

Discover More

Determining If a Number is Odd or Even

Need to know if a number in a macro is odd or even? It's easy to figure out with the simple calculation shown in this tip.

Discover More

Generating Double-Digit Random Numbers

Normally you use the RAND and RANDBETWEEN functions to generate random numbers. What if you want to generate random numbers ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (ribbon)

Converting Numbers to Text

Got some numbers you need spelled out? Here's a handy macro that can convert numbers like "123" to words like "one hundred ...

Discover More

Clean Up Your Macro List

Macros are part of the document and template that are loaded into memory when you open a file. If you have "junk" macros in ...

Discover More

Continuing Macro Lines

Program a macro, and you can easily find that some lines get very long. If you want to shorten the lines so they are more ...

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 8Mpixels. 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 0 + 7?

2016-03-03 02:17:05

Don Farrell

Please help!

I need find a way to execute a macro that will set the next day's date into a document in several places.

I have the macros from this site but they will only execute if I use the run Macros.

I need the macro to auto-update each time the document is opened.

FYI the document is a list of scheduled activities that must be signed and dated in several places. It spans two consecutive days.


2015-10-29 09:43:36

T P Johnston Jr

I attempted to edit this macro as I need the date inserted 3 days after the document is created. The MyDate text is in a text box. But the macro simply does not work at all. I open the newly created Template (dotm) and nothing happens with the MyDate bookmark.


2015-06-08 13:10:15

Rick G.

Cari, Allan said to use the name "AutoNew" for the macro and save it in a Template doc that contains a bookmark called "MyDate".
AutoNew is a special name for a macro. If you have a macro by that name, it runs automatically whenever a New document is created based on that template.
|||
If you don't want to have a special template for docs that contain the future date, you can make a macro with a regular name like "InsertTomorrowsDate" instead of "AutoNew". That macro would look like this:
|||
Sub InsertTomorrowsDate()
Selection.InsertBefore Format(Date + 1, "dd mmmm yyyy")
End Sub
|||
You could save that macro in your Normal template and run it manually. To run it, you could click on the View tab on the ribbon, click the Macros button (on the right end of the ribbon), and select the macro that you want to run. That would put tomorrow's date in the active doc where your Insertion Point (cursor) is.


2015-06-08 12:56:04

Marc Hichens

Once the macro code has been written, the easiest way to repeatably execute the macro is by adding it to the Quick Access Toolbar. The detailed instructions are included in this tip:

http://wordribbon.tips.net/T006011_Adding_a_Macro_to_the_Quick_Access_Toolbar.html


2015-05-22 03:18:22

Cari

Please could you assist with the full step by step instructions, I can't figure out how to run the macro once the code is entered.


2014-08-27 10:22:37

Diana

Here are the instructions for Macro -- http://wordribbon.tips.net/T006821_Writing_a_Macro_from_Scratch.html


2014-06-16 06:19:25

OGBO

Could you provide step-by-step instructions for this process? I was completely lost at the word "macro." I'm not familiar with much of the terminology but I believe I could get the date into the template with specific instructions.


2014-05-20 20:34:05

j

Could you provide step-by-step instructions for this process? I was completely lost at the word "macro." I'm not familiar with much of the terminology but I believe I could get the date into the template with specific instructions. Thanks,
J


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu 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.