Sometimes
when working with Word documents, you may wish to save numbered (and
dated) versions of the document for future reference. The following
macro
should be attached to a personal toolbar button or keyboard
shortcut for ease of access.
When
activated, the macro stores the current date in the format indicated in
red in the line:
strDate = Format((Date), "dd
MMM yyyy")
It then
checks whether the document has been saved by looking for a path
associated with the document. If this is
not present, you are given the opportunity to save the file with your
own choice of name and location. The macro then checks the filename
again and strips the extension. If the file in question is already one
that has been created as a version by this macro the version details are
also stripped.
The version
numbers for each named document are stored in a document variable
varCount
If this
variable
doesn't exist, (and it won't in a new document) the macro creates it.
Finally the
macro increments the version number and recreates a filename based on
the original stripped filename with the addition of the version number
and date. The result can be seen in the illustration at the end of this
page.