View Single Post
 
Old 03-13-2017, 11:35 AM
Charles Kenyon Charles Kenyon is offline Windows 10 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,530
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

That macro was designed to be called from another macro that would supply a name. You could simplify the process:

Code:
Public Sub FileSave()
    ' Run as substitute for FileSave to add date to default document names
    ' Put in a document or global template as public macro
    ' Base name comes from the Title Property in the template

    Dim dlgSave As Dialog
        On Error Resume Next
   
    If Len(ActiveDocument.Path) > 0 Then
      ' The document has already been saved at least once.
      ' Just save and exit the macro.
      ActiveDocument.Save
      Exit Sub
    End If
    '
     'get name from title property
    strName = ActiveDocument.BuiltInDocumentProperties("Title").Value
    '   
    strName = strName & " " & Format((Year(Now() + 1) Mod 100), "20##") & "-" & _
        Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
        Format((Day(Now()) Mod 100), "0#")
'
    Set dlgSave = Dialogs(wdDialogFileSaveAs)
    With dlgSave
        .Name = strName
        .Show
    End With
End Sub
Remember, if you want any base name rather than just the date, put that name in the Title property of your template.
Reply With Quote