Using a Macro to Insert a Custom Formatted DateLast reviewed: February 5, 1998Article ID: Q121983 |
The information in this article applies to:
SUMMARYThis article describes how to write a macro that prompts you to enter a number of days from the current day and then inserts the resulting date in a custom format.
MORE INFORMATIONWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Word 7.0 -------- Sub MAIN Defaultdate$ = GetPrivateProfileString$ (HKEY_CURRENT_USER\software\Microsoft\Word\7.0\Options", "dateformat", "") SetPrivateProfileString "HKEY_CURRENT_USER\software\Microsoft\Word\7.0\Options", "dateformat", MMM d, yyyy", "" NumDays = 30 SerialEndDate = Now() + NumDays EndDate$ = Date$(serialEndDate) Insert enddate$ SetPrivateProfileString "HKEY_CURRENT_USER\software\Microsoft\Word\7.0\Options", "dateformat", "defaultdate$", "" End Sub Word 6.0
Sub MAIN Defaultdate$ = GetPrivateProfileString$("microsoft word", "dateformat","winword6.ini") SetPrivateProfileString "microsoft word", "dateformat", "MMMM d, yyyy", "winword6.ini" NumDays = 30 SerialEndDate = Now() + numDays EndDate$ = Date$(serialEndDate) Insert enddate$ SetPrivateProfileString "microsoft word", "dateformat", defaultdate$, "winword6.ini" End Sub |
KBCategory: kbusage kbmacro
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |