Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Using a Standard Format in a Suggested File Name.

Using a Standard Format in a Suggested File Name

by Allen Wyatt
(last updated January 27, 2017)

2

Richard asked if there was a way to modify the Word-generated file name that is suggested when you choose Save As or, in the case of a brand new document, click the Save tool. He wants to suggest a standard file named that contains the date as the prefix for that name.

There are actually two different concepts at work here, depending on whether you are working on a new document or an existing document. If you are working with an existing document, then the file name suggested when you click on Save As is actually the document's current file name.

If you are working with a new document, then there is no functional difference between choosing Save or Save As; they both pull up the Save As dialog box. In this case, the suggested file name is based on the setting of the Title field in the Properties dialog box. If there is nothing in the Title field, then the suggested title is based on the first line of text in the file, up to the first punctuation mark.

Given the way that Word comes up with the suggested names, there are a couple things that can be done to utilize a standard. The first is to modify the template used for the documents, so that the Title field is set in it. For instance, follow these steps:

  1. Load Normal.dot or the template you want to modify.
  2. Display the Properties dialog box for the file. If you are using Word 2007, click the Office button | Prepare | Document Properties and then use the Document Properties drop-down list to choose Advanced Properties. If you are using Word 2010 or Word 2013, display the File tab of the ribbon and click Properties | Advanced Properties.
  3. Make sure the Summary tab is displayed. (See Figure 1.)
  4. Figure 1. The Summary tab of the Properties dialog box.

  5. In the Title field, enter the pattern you want used for file names. For instance, you might enter "yyyymmdd - Title".
  6. Click OK.
  7. Save and close the template.

Now, whenever you open a document based on that template, the Title field will already be set. When someone first saves the document, the title you entered in step 4 is suggested. This will spur the user to replace "yyyymmdd" with the proper date, and replace "Title" with the real title.

If you want something more automatic—perhaps where the date is automatically filled in—then you need to rely on a macro. You essentially need to create a macro that replaces the Save and Save As commands, and fills in the suggested file name as you want it done. Information on how to intercept various commands (such as Save and Save As) can be found at the Word MVP Web site:

http://www.wordmvp.com/faqs/macrosvba/InterceptSavePrint.htm

In the macro you create, you can set the desired name before showing the File Save As dialog box. For instance, this snippet of code will handle the trick:

Dim sDefaultFileName as String
sDefaultFileName  =  "MyPaper"
With Application.Dialogs(wdDialogFileSaveAs)
    .Name = sDefaultFileName
    .Format = 0     '2 = Plain Text, 0 = Word Doc
    If .Show = 0 Then   'User did not save
    End If
End With

Remember that this code needs to be placed within a larger macro that you develop as a replacement for the Save As command. The .Show method is what actually displays the dialog box.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13283) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Using a Standard Format in a Suggested File Name.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding Point Sizes

Points are the common unit of measure for typefaces in the printing industry. They are also used quite often in Word. Here's ...

Discover More

Determining if Overtype Mode is Active

Your macro may need to determine if the user has overtype mode turned on. You can find out the overtype status easily by ...

Discover More

Making Ignore All Work for a Document on All Systems

When you tell Word's spell checker to ignore all instances of a misspelling, you may expect that the misspelling will be ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Renaming a Document

Want to rename a document that is already on your hard drive? You can, of course, do it in Windows, but you can also do it in ...

Discover More

Can't Save Edited Document

Each day of using Word is filled with opening documents, editing them, and then saving those changes to disk. So it can be ...

Discover More

Opening a Text File and Template from the Command Line

Word includes a command-line syntax that you can use to open files and do other operations. If you want to load a text file ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 4 + 1?

2014-10-23 07:26:06

Peter Johnson

Rather than have a fixed title (as Allen suggests) consider a unique title for each document. What we do is to have a NewDocument macro that is called from the AutoNew macro. It displays a simple form that gathers key information such as:
o Client
o Project
o Publication Date
o Document Type

These are then use to complete such things as the Title and Subject document properties and to suggest a file name. As described this is done by displaying the FileSaveAs dialogue box. This is similar to Andrew's suggestion but with the crucial differences that:
o the Title and Subject have both been promoted for when the document is first created
o the document is saved with the captured information and filename at the earliest opportunity

This allows you to generate filenames such as:

Client_Project_DocType_PubDate.docx


2014-10-18 20:12:33

Andrew Martin

So here is what I did for all our internal documents:
I made an AutoClose macro (that runs when you try and close) or when you hit the button I have loaded on the users toolbar.
It uses the
Sub AutoClose()
' A macro with the specific name FileSave is called
' whenever the user saves a document attached to
' this template.
If ActiveDocument.Path = "" Then
' If the document has never been saved, the value of its .Path is an empty string; otherwise it has the file's path and name.
With Dialogs(wdDialogFileSaveAs)
.Name = MakeDocName ' call the function below
.Show ' the suggested name will be in the dialog
End With
Else
' The document has already been saved with a name
' so just save it there.
ActiveDocument.Save
End If
End Sub
Function MakeDocName() As String
Dim theName As String
Dim uscore As String
uscore = "_"

With ActiveDocument.Bookmarks
' Use any combination of bookmarks and document properties to assemble the suggested name.
theName = ActiveDocument.BuiltInDocumentProperties("title")
theName = theName & uscore & ActiveDocument.BuiltInDocumentProperties("subject")
theName = theName & uscore & _
ActiveDocument.BuiltInDocumentProperties("author")
End With

MakeDocName = theName ' return the assembled name
End Function

This gives you names like the following:
Title_Subject_Author.docx

Now you can add other parts to this and put dates in the name, but for our needs this works perfectly and should I need to in the future, I can change that and make anything needed.

Hope that this adds to the conversation.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.