Microsoft KB Archive/71343

{|
 * width="100%"|

Word for Windows Macro to Insert Specified Dates

 * }

Q71343

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows NT, version 6.0
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SUMMARY
In Word, you can use a macro to have the date inserted be a number of days before or after today's date.

MORE INFORMATION
As an example, to insert a date that is seven days after today's date, you would insert the following in the macro editor depending on the platform used:

Word 6.0 for Windows NT
Sub MAIN a$ = GetPrivateProfileString$(&quot;HKEY_CURRENT_USER\software\Microsoft\Word\6.0\Opt ions&quot;, &quot;DateFormat&quot;, &quot;&quot;) SetPrivateProfileString &quot;HKEY_CURRENT_USER\software\Microsoft\Word\6.0\Options&quot;, &quot;DateFormat&quot;, &quot;MMMM dddd, yyyy&quot;, &quot;&quot; Insert Date$(Today + 7) SetPrivateProfileString &quot;HKEY_CURRENT_USER\software\Microsoft\Word\6.0\Options&quot;, &quot;DateFormat&quot;, a$, &quot;&quot; End Sub

Word 6.0 for Windows
Sub MAIN a$ = GetPrivateProfileString$(&quot;Microsoft Word&quot;, &quot;DateFormat&quot;, &quot;Winword6.Ini&quot;) SetPrivateProfileString &quot;Microsoft Word&quot;, &quot;DateFormat&quot;, &quot;MMMM d,yyyy&quot;, &quot;Winword6.Ini&quot; Insert Date$(Today + 7) SetPrivateProfileString &quot;Microsoft Word&quot;, &quot;DateFormat&quot;, a$, &quot;Winword6.Ini&quot; End Sub

Word 6.0 for Macintosh
Sub MAIN a$ = GetPrivateProfileString$(&quot;Microsoft Word&quot;, &quot;DateFormat&quot;, &quot;Word Settings (6)&quot;) SetPrivateProfileString &quot;Microsoft Word&quot;, &quot;DateFormat&quot;, &quot;MMMM d,yyyy&quot;, &quot;Winword6.Ini&quot; Insert Date$(Today + 7) SetPrivateProfileString &quot;Microsoft Word&quot;, &quot;DateFormat&quot;, a$, &quot;Word Settings (6)&quot; End Sub Additional query words: future previous yesterday's

Keywords :

Issue type :

Technology :