Converting Many DOC Files to DOCX

by Allen Wyatt
(last updated April 29, 2017)

Christian has a folder full of DOC files that he needs to convert to DOCX files. He wonders if there is a quick way to convert them without opening and saving each one individually.

Microsoft does not provide this functionality in Word, nor do they provide an add-in to do the conversions. You can, however, create your own macro to do the conversions. A rather simple approach is shown here:

Sub ConvertBatchToDOCX()
    Dim sSourcePath As String
    Dim sTargetPath As String
    Dim sDocName As String
    Dim docCurDoc As Document
    Dim sNewDocName As String

    ' Looking in this path
    sSourcePath = "c:\Users\Administrator\Desktop\Testing\"
    sTargetPath = "c:\Users\Administrator\Desktop\Converted\"

   ' Look for first DOC file
    sDocName = Dir(sSourcePath & "*.doc")
    Do While sDocName <> ""
        ' Repeat as long as there are source files
        
        'Only work on files where right-most characters are ".doc"
        If Right(sDocName, 4) = ".doc" Then
            ' Open file
            Set docCurDoc = Documents.Open(FileName:=sSourcePath & sDocName)

            sNewDocName = Replace(sDocName, ".doc", ".docx")

            With docCurDoc
                .SaveAs FileName:=sTargetPath & sNewDocName, _
                  FileFormat:=wdFormatDocumentDefault
                .Close SaveChanges:=wdDoNotSaveChanges
            End With
        End If
        ' Get next source file name
        sDocName = Dir
    Loop
    MsgBox "Finished"
End Sub

In order to use the macro, you'll need to make two changes. First, specify in the sSourcePath variable the full path (followed by a backslash) to the directory that contains the files you want to convert. Then, in the sTargetPath variable, specify the full path (with trailing backslash) of the directory in which the converted documents should be stored.

The macro then steps through all the DOC files it finds in the source directory, opens them, and saves them as DOCX files in the target directory.

Note that I mentioned this is a simple approach. The reason is because it does no error checking on its work. For instance, if you ran this macro twice in a row, you would get errors because the files being saved in the target directory already exist. Further, you should understand that this converts all the DOC files to DOCX files. In other words, if the original file has macros in it, those macros will be stripped off in the conversion process.

Finally, notice that the heart of the macro is contained within an If / Then structure that checks to make sure the rightmost 4 characters of the filename are actually ".doc". This is done because of the rather aggravating behavior of the Dir function on some systems where searching for the pattern "*.doc" will return as a match any filename that contains .doc. This means that it also returns files ending in .docx and .docm. Obviously, these should not be converted, so the If / Then structure is included to weed them out.

If you prefer to not use your own macro, there are third-party solutions you could use. The following page on Graham Mayor's site features a free add-in that will, among other things, do the document conversion:

http://www.gmayor.com/document_batch_processes.htm

You may be able to locate other similar converters by doing a web search for "doc docx converter" (without the quote marks).

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (643) applies to Microsoft Word 2007, 2010, 2013, and 2016.

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

Losing All Formatting in a Document

Have you ever made a formatting change to a couple of characters or to a paragraph, only to see those changes affect text ...

Discover More

Leaving a Cell Value Unchanged If a Condition Is False

Ever want the IF function to only return a value if the condition it is testing is true, and not if the condition is false? ...

Discover More

Removing Hyperlinks without a Macro, Take Two

Need to get rid of hyperlinks in a worksheet? Here's an easy way to do it without using a macro.

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

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 ...

Discover More

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. ...

Discover More

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 ...

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 2 + 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.