Written by Allen Wyatt (last updated October 7, 2021)
This tip applies to Word 2007, 2010, 2013, and 2016
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:
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.
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!
Don't you love all the acronyms used in computer terminology? One such acronym--"pertinent to Word users--"is MRU. This ...
Discover MoreWhat are you to do if you try to open a document and Word automatically closes your previous document? Word is not ...
Discover MoreBackup files, created automatically by Word, have the filename extension WBK and start with the words "Backup of." If you ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments