View Single Post
 
Old 05-12-2012, 11:15 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Sheeand,

Probably the simplest solution is to add a 'Document_New' sub to your Journal template's 'ThisDocument' module, coded as:
Code:
Private Sub Document_New()
Dim StrPath As String
Strpath = "C:\Users\" & Environ("UserName") & "\Documents\Journals\"
ActiveDocument.SaveAs2 FileName:=StrPath & "Journal " & Format(Now, "YYYY-MM-DD"), Fileformat:=wdFormatXMLDocumentMacroEnabled
End Sub
This will automatically save the file with today's date immediately it's created. Note that I've retained the 'docm' format, though I'm not sure why you'd need it. If you're not going to have macros in it, you should use the docx format, in which case you can delete the 'MacroEnabled' string from the code.

Alternatively, you could use a '' macro coded like:
Code:
Sub FileSave()
Dim StrPath As String
StrPath = "C:\Users\" & Environ("UserName") & "\Documents\Journals\"
With ActiveDocument
  If Right(Split(.Name, ".")(0), 10) Like "[####-##-##]" Then
    .Save
  Else
    .SaveAs2 FileName:=StrPath & "Journal " & Format(Now, "YYYY-MM-DD"), Fileformat:=wdFormatXMLDocumentMacroEnabled
  End If
End With
End Sub
This will intercept save attempts via Ctrl-S.

You will, of course, need to edit the filepath in the 'StrPath' variable to suit your requirements. Note also my somewhat simpler method of adding the date string.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote