Austin Fox's personal website.

Bulk Doc to Docx Conversion

|

This Microsoft forum post pretty much explains it but Iā€™m gonna restate here.

In a VBA Module:

Sub TranslateDocIntoDocx()
  Dim objWordApplication As New Word.Application
  Dim objWordDocument As Word.Document
  Dim strFile As String
  Dim strFolder As String

  strFolder = "D:\doc\"
  strFile = Dir(strFolder & "*.doc", vbNormal)

  While strFile <> ""
    With objWordApplication
      Set objWordDocument = .Documents.Open(FileName:=strFolder &strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)

      With objWordDocument
        .SaveAs FileName:=strFolder & Replace(strFile, "doc", "docx"), FileFormat:=16
        .Close
      End With
    End With
    strFile = Dir()
  Wend

  Set objWordDocument = Nothing
  Set objWordApplication = Nothing
End Sub

Replace "D:\doc\" with your file path. Remember to include the trailing ā€œ\ā€.

If your path is wrong it will not tell you. It may do some weird multi docxx creation. Script could use some updates. I may look into updating it if I have to use it again.

Comments