Your Word documents are stored in files, so understanding how to maintain them is crucial. The following articles explore everything from the basics of file naming to problems you may run into with file conversion and transferring. Organize your documents into manageable files on your computer easily with these tips.
Tips, Tricks, and Answers
The following articles are available for the 'Files' topic. Click the article''s title (shown in bold) to see the associated article.
Appending to a Non-Document Text File
Your macros can easily add information to the end of an existing text file. This is done by opening the target file in Append mode, as described in this tip.
Automatically Formatting an ASCII File
Import a file from a source external to Word, and you can end up with a formatting nightmare. One big step is to remove any extra hard returns in the document. The macro in this tip is very helpful in this regard.
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 frustrating if Word doesn't allow you to save your edited documents. Here's some things you can try to get back the capability.
Cannot Open Multiple Word Documents
What are you to do if you try to open a document and Word automatically closes your previous document? Word is not supposed to act this way, and it can be frustrating. Here are some ideas on how you can track down the problem.
Need to combine quite a few text documents? A macro may be the easiest way to stuff them all into a single Word document.
Combining Word Documents
At some point you may want to insert one Word document inside another Word document. An easy way to do this is to use the INCLUDETEXT field, described in this tip.
Complex Searches for Documents
When working with lots of documents, you may have need from time to time to discover which of those documents contain some specific bit of text. Finding the documents within Word can be difficult, so the answer to your searching needs may rest with a third-party utility.
Confirming File Conversions
Open a file that isn't a Word document and Word will still try to convert it to a Word document. If you want Word to let you know when it is going to do these conversions, here's how to specify that.
Controlling Names of Backup Files
Want to control the name and location of your document backup? Here are some ideas that may help.
Converting from Open Office to Word
If you have a number of documents in Open Office format, you may want to work with them in Word. There are several ways that you can open them, as described in this tip.
Converting Many DOC Files to DOCX
Need to convert a bunch of old DOC files to the newer DOCX format? Word doesn't provide the capability to convert a bunch of them at once, but there are ways you can do the conversion quickly by using the ideas in this tip.
Converting to Word 6.0 Format
Need to convert your document to a really old format previously used in Word? The solution may already be built into the program.
Copying Custom Properties
You can add custom properties to a document to help with all sorts of file management tasks. If you want to copy these custom properties from one document to another, you'll need to rely on a macro like the one presented in this tip.
Creating a Document Clone
If you need to work with a copy of a document rather than the original document, you can use Word's Open dialog box to specify that need. Here's how.
Default Picture Location
When you insert pictures into a document, the first folder that Word opens up is normally the My Pictures folder. You can change the starting folder by making a change in Word's configuration.
Deleting MRU Entries
By default Word dutifully keeps track of the different files you've worked on in the past. If you want to delete an entry from the list that Word maintains, you'll want to understand the technique discussed in this tip.
Determining If a File Exists
Your macro may need to know if a particular file exists. This is easy to figure out using the Dir command, and even easier if you use it in the function provided in this tip.
Determining If the End of a Text File Has Been Reached
When writing a macro that processes a text file, you may need to know when the end of the file has been reached. This is easy to do with the EOF function, described in this tip.
Determining the Length of a Non-Document Text File
If you use a macro to create and work with text files, you can find out the length of those files using a simple command. This tip explains how to use the LOF command to get the info you need.
Document Shows as 'In Use' by Another User
Word tries to constantly track who is using various documents, in order to prevent two users from clashing in their edits to a single document. What if Word reports that a document is being used by someone else when you know that it isn't? Here's how to get back control of the document with a minimum of fuss.
Embedding TrueType Fonts by Default
If you use TrueType fonts frequently, you might want to set Word to embed those fonts by default. Here's how to do it.
Erroneous Out of Space Messages
While they are less common these days than they used to be, you still might see an error that indicates Word is out of disk space. Here are some ideas on how to track down and correct such errors.
Formatting Text Files with VBA
Got a bunch of text that you've imported from a text file? Need to make it look better? You can take a stab at it with this macro.
Formatting Text in Custom Document Properties
Word allows you to create custom document properties that stay with a document and can be inserted through the use of fields. Formatting characters in those properties is not something you can easily do, however.
Getting Input from a Text File
VBA includes some commands that you can use to read information from text files (non-Word documents). These commands can come in handy when you need to access a wide variety of information. This tip presents a very simple technique to use these commands and read information from a text file.
Getting Rid of MRU Entries
By default Word dutifully keeps track of the different files you've worked on in the past. If you want to delete an entry from that list that it maintains, you'll want to understand the techniques discussed in this tip.
Grabbing the MRU List
The MRU (most recently used) list informs you which documents were the last to be opened and edited in Word. You can access the list in a macro by using the RecentFiles collection, as illustrated in this tip.
Importing a Text File and Inserting after a Bookmark
Word macros are a great way to automate some of the ways in which you create documents. If you have a need to insert the contents of a file within the current document, on a regular basis, then a macro can be a great help. Here are some ideas on how to approach the problem.
Inserting a File
Need to combine several files into a single document? You can do it by inserting one file into another, as outlined in this tip.
Inserting a File Name without an Extension
Sometimes you might like to insert a file name into your document without including the file extension. The FILENAME field does not have an option to do this. Here are a couple of workarounds that allow you to insert the file name this way.
Inserting Only Part of a File
You can easily insert one document within another document. What you may not know is that you can limit which part of a document you actually insert.
Jumping Around Folders
If you need to move between two different folders quite regularly in the Open dialog box, you'll find the technique described in this tip to be helpful. It allows you to jump right to the folder you need without the need to go through tiresome navigation steps.
Keeping the Flash Drive Occupied
Working on a document stored on a flash drive can have some unintended consequences. Here's some help in understanding how Word affects these types of drives.
Last Document Saves Not Saved
Click the Save button and you expect your document to be saved, right? What if you later discover it wasn't really saved? There could be a few snafus at play in such a situation, as addressed in this tip.
Leading Spaces in Document File Names
If you try to add spaces to the beginning of a document's file name, Word normally strips them away. This tip examines two ways you can add those spaces back to the beginning of your file names.
Limits on Path Length in Word
When you organize your hard drive, it is easy to go hog-wild with folders and subfolders. You need to know that how you create that folder structure can affect your ability to reference any documents within those folders. Here's an explanation that may affect your thinking.
Listing Documents with Passwords
Do you need a list of documents that require a password or that require a particular password to open? Word doesn't provide a way to retrieve such information, but you could do it with a macro. This tip describes the approach that should be used if you decide to develop such a macro.
Making Backup Copies
When you save your documents, Word doesn't normally make backups of your files. If you want the program to do that, it takes a quick configuration change, as described in this tip.
Making Common Information Accessible
Got a bunch of info that is common to a lot of your documents? Here's a way to get that information standardized among all those documents.
Modifying the Backup Copy File Name
Backup files, created automatically by Word, have the filename extension WBK and start with the words "Backup of." If you want to change this naming convention, you may be out of luck, but you can always rename the files outside of Word.
Opening a Backup File
If you have Word configured to save backup copies of your document, you may want to actually load one of those copies at some point. Here's the easy way to load the file.
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 from the command line and have Word use a specific template with that file, you might have a hard time getting it done. If you apply the techniques in this tip, you can get just what you want.
Opening Only a Merge Document
After merging the information from a data source into a document, you may decide that you only want to open the merge document from that point on. This tip explains how Word treats the files involved in a mail merge.
Periodically Delete TMP Files
After using Word for a while, you may notice some "litter" of unused files on your hard drive. This tip explains how those files came to be there and when it is safe to delete them.
Positioning the Cursor in a New Document
Creating special templates is a great way to establish "standards" for your documents. With a little ingenuity you can even force the insertion point to a set location in a new document created from your templates. This tip shows how easy this is to accomplish.
Printing a File List
It is often helpful to have a list of all the documents in a given directory or folder. Word doesn't have a built-in way to generate such a list, but there are a couple of ways you can get the desired information.
Problems Saving as PDF
When sharing documents with others, it's hard to beat the versatility and consistency of a PDF file. Word 2010 allows you to create a PDF file from a document, but what do you do if it refuses to create?
Removing All File Properties
Want to get rid of any properties you've created for a document? You can do so by using the short macro described in this tip.
Removing Pictures from Multiple Files
Working with a single document is easy. Working with thousands of documents becomes much harder. If you need to get rid of pictures in a particular area of many, many documents, you'll appreciate the macro in this tip.
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 Word itself by using the Open dialog box. This tip explains the process you can use.
Saving and Closing All Open Documents
Want to close or save all your documents at the same time? This trick does it for you.
Saving Documents as Read-Only by Default
When you save your documents, you can specify that they be saved in a "read-only" format so that they cannot be changed as easily. This tip explains how you can modify the Save As command so that documents are saved as read-only by default.
Saving Documents Using the Same Filename
When working on a document, you most often want to save your edits using the existing name of the document. If Word thinks your document is read-only, it forces you to save the document using a different name. If you run into problems saving your document using the existing filename, here are some things you can check.
Saving in a Macro Using a Desired File Name
Need to save a new document, from within a macro, to a specific file name? If you use the Record Macro capabilities of Word, you won't get the results you want. The information in this tip provides the answers, as well as a whole lot of different ways you can approach the problem.
Saving Information in a Non-Document Text File
Need to store some information in a plain text file? It's easy to do when you use a macro.
Saving Portions of Files
Want to save snippets from a document into individual files? There are a couple of easy ways to achieve this goal, as described in this tip.
Saving Your Work Automatically
Word can be configured to save your work periodically, on any time schedule you desire. This tip explains this feature and shows you how to do the necessary configuration.
Searching for a Document
When switching from one version of Word to another it can be confusing to figure out where all the commands and features are located in the new version. Nowhere is this more evident than when people upgrade to Word 2007. This tip examines how you search for documents in different versions of Word, including Word 2007.
Setting the AutoRecover Directory
When you are using Word, it normally saves temporary AutoRecover files that reflect the latest state of your document. If you want these AutoRecover files to be stored in a certain place, you can configure Word to make that specification.
Setting Your Default Document Directory
Word allows you to specify where it should start looking for your documents. This setting can come in handy if you store your documents in a specific directory structure.
Specifying a Location To Save Automatic Backup Files
Word allows you make two types of automatic backups of your documents. One is a copy of the file before you start making changes to it. The other is a timed automatic backup.
Understanding Background Saving
Word has the capability to save your work, in the background, while you continue to edit your documents. This tip explains that capability and shows how you can turn it on or off.
Sarah has a document that she needs to save in two different folders on her system. She wonders if there is a way to have any updates to one copy of the document be automatically reflected in the other copy of the document.
There are actually several ways you can approach this problem. One is to create a macro that actually saves the document into two locations. Here is an example of a macro that does that.
Sub DualSave() Dim FirstFolder As String Dim SecondFolder As String Dim DocName As String Dim objF As Object Dim retVal As Long SecondFolder = "c:\MyLocation\" With ActiveDocument If Not .Saved Then .Save FirstFolder = .Path & "\" DocName = .Name If FirstFolder = SecondFolder Then MsgBox "WARNING! Second folder is the same as first folder." Exit Sub End If Set objF = CreateObject("Scripting.FileSystemObject") retVal = -1 On Error Resume Next retVal = objF.CopyFile(FirstFolder & DocName, _ SecondFolder & DocName, True) On Error GoTo 0 Set objF = Nothing If retVal <> 0 Then MsgBox "File could not be copied to folder " & SecondFolder End If End If End With End Sub
Such a macro is rather simplistic, in that it copies from where you are now to a second folder (specified in the SecondFolder variable). That means that if you open up the document in the second folder and then save it, the original document is not updated and running the DualSave macro will generate an error. (The error occurs because the first and second folder names will be the same.) For this reason, a macro approach such as this is more suitable if you want to copy to a second location as a way to make backups of your documents. An add-in created by Word MVP Graham Mayor does essentially the same thing:
Another approach (that doesn't require a macro) is to create your main document and then create the mirror document by using the "Paste Link" capabilities of Word. You simply select the entire first document and then use, within the mirror document, Paste Link to paste the information. The result is that the mirror document always reflects whatever is in the main document. (Additional information on how to link Word documents is presented in other WordTips.) The drawback is that you cannot make changes in the mirror document and have those reflected in the main document; the mirroring is only in one direction.
Perhaps the best solution, however, is to not rely on Word at all. Instead, save your main document and, in Windows, create a shortcut to that main document. Move the shortcut to the second folder, and you are ready. Now someone can open either the original document or the shortcut, and it will always refer to the same document. To create the shortcut, do the following:
- Save your document and exit Word completely.
- Locate and right-click the document file you just saved. Windows displays a Context menu.
- Choose Create Shortcut. The shortcut is placed in the same folder as the original document.
- Open a window for the second folder.
- Drag the shortcut from the first folder to the second folder.
Your shortcut is now in place. If you double-click it, the Word opens the original document. You now essentially have a single document accessible through two different folders. The drawback to this approach, of course, is that the second folder only contains a shortcut to the original document, which means you should not consider the shortcut as a backup of the original document; it isn't. If you are actually looking for a way to make backup copies of documents, then use one of the other solutions discussed in this tip.
Understanding the PDF/A Format
Word allows you to save your documents in PDF format so others can easily view them. You may not know, however, that Word allows you to save your document in the PDF/A file variation. Here's what that variation entails and how you can save your documents in that format.
Use Filenames that Sort Properly
If you take some care when you name your document files, you'll find it much easier to manage those files at a later time. This tip provides some guidance that you may find helpful as you consider how you should name your files.
Using a Standard Format in a Suggested File Name
Many companies (and some individuals) use specific formats for naming their documents. If you want Word to recognize your particular format, here are some ideas you can use.
Using Header Information as the Filename
Save a document for the first time, and Word helpfully suggests a filename you can use or change. If you want this suggested filename to come from a particular place in your document (such as a header), you may be out of luck. However, there is a workaround you can try.
Using Seek In a Macro
When processing non-document text files in a macro, you have a wide range of commands available for your use. One of those is the Seek command, which allows you to position the internal file pointer within the text file.
Viewing Files of a Certain Type
When you choose to open a file, Word normally displays only those files that end with the .DOCX or .DOCM extensions. If you want to display files that use a different extension, you can use the information in this tip.