Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Save As węth date and time
In the Excel group someone posted a macro for saving an Excel worksheet with
the date and time automatically appended. Is there a way to do a similar thing in Word? When the macro is run it will save a copy of the file with the current name (basename) but with the date and time appended thus for example: basename yymmdd hhmm TIA -- Bob http://www.kanyak.com |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Save As węth date and time
You need something along the lines of the following, which will save a timed
and dated copy (in the requested format) in the folder defined in strBackupPath. This must be a valid folder name. If you set strBackupPath = "" the backup copy will be saved in the current folder. The original document remains the active document. The macro should work with doc and docx formats. See also http://www.gmayor.com/automatically_backup.htm Sub SaveATimedCopy() Dim strFileA As String Dim strFileB As String Dim strFileC As String Dim strBackupPath As String strBackupPath = "D:\My Documents\Test\" With ActiveDocument .Save strFileA = .Name If Right(strFileA, 1) = "x" Then strFileB = Left(strFileA, Len(strFileA) - 5) & _ Chr(32) & Format(Date, "yyMMdd") & _ Chr(32) & Format(Time, "hhmm") & ".docx" Else strFileB = Left(strFileA, Len(strFileA) - 4) & _ Chr(32) & Format(Date, "yyMMdd") & _ Chr(32) & Format(Time, "hhmm") & ".doc" End If strFileB = strBackupPath & strFileB strFileC = .FullName .SaveAs FileName:=strFileB .SaveAs FileName:=strFileC End With End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Opinicus wrote: In the Excel group someone posted a macro for saving an Excel worksheet with the date and time automatically appended. Is there a way to do a similar thing in Word? When the macro is run it will save a copy of the file with the current name (basename) but with the date and time appended thus for example: basename yymmdd hhmm TIA |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Place the document save date and time in the name of the word docu | Microsoft Word Help | |||
Removing Revision Number and Edit Time, Date Created, Date Last Sa | Microsoft Word Help | |||
Need Save Date - Not Save Date & Time Field | Microsoft Word Help | |||
paste time and date into save as | New Users | |||
Format Date and Time to show Military Time | Microsoft Word Help |