Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to save Word document with current date in filename?

If you need to add the current date in filename automatically when saving a Word document, how could you deal with this task in Word file?

Save a Word document with current date in filename with VBA code


Save a Word document with current date in filename with VBA code

To automatically add the current date into the filename when saving the Word document, please do with the following steps:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. And then, click Insert > Module, copy and paste below code into the opened blank module:

VBA code: Save a Word document with current date in filename

Public Sub FileSave1()
    Dim xDlg As Dialog
    Dim xTitle As String
    On Error Resume Next
    xTitle = ActiveDocument.BuiltInDocumentProperties("Title").Value
    xTitle = xTitle & " " & Format((Year(Now() + 1) Mod 100), "20##") & "-" & _
        Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
        Format((Day(Now()) Mod 100), "0#")
    Set xDlg = Dialogs(wdDialogFileSaveAs)
    xDlg.Name = xTitle
    xDlg.Show
End Sub

3. After pasting the code into the module, press F5 key to run this code, and a Save As window is displayed with the current date automatically into the File name text box, see screenshot:

doc save with date 1

4. And then, you just need to type your own file name as you need, see screenshot:

doc save with date 2

Recommended Productivity Tools

shot kutools word kutools tab 1180x121
shot kutools word kutools plus tab 1180x120
 

Kutools For Word - More Than 100 Advanced Features For Microsoft Word, Save Your 60% Time

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Insert multiple images across folders into Word document at once.
  • Merge and combine multiple Word files across folders in to one with your desired order.
  • Split the current document into separate documents according to heading 1, section break or other criteria.
  • Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.