| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Jun 23, 2016
|REVDATER - Adds or revises a special text date in a document to show the current date|
This is a macro that adds (or revises) a special bookmarked date text string in a document to make it easy to "stamp" a document with the current revision date as static text, not as a changeable date code.
The macro works by searching for a specifically bookmarked date text string, and if it is found, it replaces the text string with the current date (also as a text string).
If it is not found, it inserts the current date at the cursor location, bracketed with the specified bookmark codes, ready to be found and changed again (if needed) if you play the macro later.
Note that due to the way the macro was designed only one such special date can exist in the current document.
To change the location of this special date, open Reveal Codes and delete the [Bookmark] codes and the date's text characters. When you play the macro again in that document it will insert the bookmark and date at the current cursor location.
Modifications and tips
☼ You can change or omit the optional text label that precedes the date string (default = "Revised: ") in the redlined User Modification Area of the macro's code.
☼ Other options are available:
• You can choose to show or suppress a couple of pop-up user messages during the macro's operation. (default = display all messages)
• You can set the macro to optionally save the document after it adds/updates the revision date. (default = don't save)
If the document has not yet been saved the macro will pop up the Save File dialog so that you can name the document.
If the document has been saved the macro will stamp it with the date and then automatically save it to disk, overwriting the original to update it.
[Exception: By design it will not save a macro file or template file that is currently being edited, but it will stamp the date in the macro's code or template's text. This was done because most users probably do not want to save such documents automatically (i.e., blindly) during heavy editing.]
• To add the current time (in characters) to the date stamp, add something like this command on a separate line just under the DateText() command at the bottom of the macro code:
Type (" - " + TimeString)
• For easy access to the macro you can add it to a toolbar, shortcut key, or menu. See here.
Version history -
v1.01 - (2002) Added code to visibly show the bookmarked item (by selecting the item) when if a final message displays.
v1.02 - (July 7, 2007) Revised code that removes the old date; now allows keeping the existing relative size attribute for the inserted revision date.
v1.03 - (June 23, 2016) Added code to detect if document has not yet been saved (if user wants to save document after revision date has been stamped in it). Updates to procedures and routines; added WP51CursorMovement() commands.