How to batch convert .doc format files to .docx in Word?

Converting a batch of .doc format files to .docx format can be efficiently achieved using VBA. The provided script demonstrates how you can convert multiple .doc files within a specified directory to .docx format simultaneously. Follow the steps outlined below:

Batch convert .doc format files to .docx with VBA code

1. Collect all the .doc format documents you wish to convert to .docx format in a designated folder.

2. Press Alt + F11 to open the Microsoft Visual Basic for Application window.

3. In the window, click on Insert > Module. Then copy the VBA code below into the Module window.

VBA Code: Batch Convert All .doc Format Files to .docx in a Specified Directory

Sub ConvertDocToDocx()
‘Updated by ExtendOffice 20181128
Dim xDlg As FileDialog
Dim xFolder As Variant
Dim xFileName As String
Application.ScreenUpdating = False
Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
If xDlg.Show <> -1 Then Exit Sub
xFolder = xDlg.SelectedItems(1) + “\”
xFileName = Dir(xFolder & “*.doc”, vbNormal)
While xFileName <> “”
Documents.Open FileName:=xFolder & xFileName, _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:=””, PasswordTemplate:=””, Revert:=False, _
WritePasswordDocument:=””, WritePasswordTemplate:=””, Format:= _
wdOpenFormatAuto, XMLTransform:=””
ActiveDocument.SaveAs xFolder & Replace(xFileName, “doc”, “docx”), wdFormatDocumentDefault
ActiveDocument.Close
xFileName = Dir()
Wend
Application.ScreenUpdating = True
End Sub

How to batch convert .doc format files to .docx in Word

How to batch convert .doc format files to .docx in Word

4. Press F5 to run the code. In the Open window, select the folder containing the .doc documents and click OK.

Upon completion, all the .doc format documents will be swiftly converted to .docx format, as illustrated in the screenshot below.

Using the VBA script provided above, you can conveniently convert multiple .doc files to .docx format, saving time and effort. This method offers an efficient way to handle batch file conversions within a specific folder. By following these steps, you can seamlessly manage the conversion process and ensure the smooth transition of your documents to the updated format.

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart