Insert a future date in Word


Tip
There are times -- for example, when you're creating an invoice -- when it would be handy to insert a date that is a given number of days in the future. Word's Insert--Date and Time command is no help, since it inserts the current date. Here's a macro that asks you how many days in the future to set the date, then inserts that date at the cursor location. To create the macro, follow the steps below.
1. Select Tools--Macro, type DatePlus in the Macro Name field, and click Create. This calls up the macro editing screen.
2. Between the lines Sub MAIN and End Sub, type the following commands:
DaysToAdd$ = InputBox$("Add how many days?")
NumDays = Val(DaysToAdd$)
TargetDate = Now() + NumDays
a$ = Date$(TargetDate)
Insert a$
3. Select File--Save All and enter a name for the macro sheet. Answer Yes when prompted to save the changes.
When you need to insert a future date, move the cursor to the right location, select Tools--Macro, choose DatePlus from the Macro Name list, and click Run. When prompted, type the number of days you want to add to today's date, and click OK.
If you plan to use this macro often, add it to a toolbar or assign it a shortcut key.
- George Campbell

Category: Word processing
Issue: Feb 1997
Pages: 170-171

These Web pages are produced by Australian PC World © 1997 IDG Communications