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

Displaying a Live Word Count

You can use Word's built in tools to figure out how many words are in your document. If you want a real-time, constantly ...

Discover More

Disabling a Function Key

Function keys are used to perform common tasks in Excel. If you want to disable one of the function keys, it's rather ...

Discover More

Deleting Commented Text

Word allows you to add comments to your document to aid in the development of the document. At some point you may want to ...

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)

Understanding MRU Files

Don't you love all the acronyms used in computer terminology? One such acronym--"pertinent to Word users--"is MRU. This ...

Discover More

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

Discover More

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

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 two more than 9?

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.