Converting Many DOC Files to DOCX

Written by Allen Wyatt (last updated October 7, 2021)
This tip applies to Word 2007, 2010, 2013, and 2016


2

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

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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

Conditionally Formatting an Entire Row

Need to conditionally highlight an entire row based on the contents of a single cell in each row? This tip explains how ...

Discover More

Adding Spaces in Front of Capital Letters

Got some text that is "run together" and needs spaces inserted to improve readability? There are a variety of approaches ...

Discover More

Multiple Taskbar Icons for Documents

If you like to see your open documents in multiple icons on the Taskbar, you may wonder how to make that happen. This is ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!

More WordTips (ribbon)

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

Discover More

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

Discover More

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

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}] (all 7 characters, in the sequence shown) 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 9 + 5?

2021-01-09 17:30:58

Stephen

Thanks for sharing. You can also use this online tool for converting DOC to DOCX: https://freetools.site/document-converters/doc-to-docx


2018-08-14 08:44:28

Bill Baxley

Are there resources for better understanding the word for mac docx files and for manaing the margins in word for mac


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.

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