I found a useful script to convert all DOC files in a folder to DOCX:Sub TranslateDocIntoDocx()
Dim objWordApplication As New Word.Application
Dim objWordDocument As Word.Document
Dim strFile As String
Dim strFolder As String
' No need for a menu atm
' With Application.FileDialog(4) ' msoFileDialogFolderPicker
' If .Show Then
' strFolder = .SelectedItems(1)
' Else
' MsgBox "No folder specified.", vbExclamation
' Exit Sub
' End If
strFolder = "f:\documents\"
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()
application.statusbar = strFile
Wend
Set objWordDocument = Nothing
Set objWordApplication = Nothing
End Sub
which works fine, except locking the processed files by ghost Winword processes. So I have to shut them via Task Manager first.
Could you suggest what to change--or a better solution?
Also, is it possible to combine both DOC and RTF in the the same filesearch?
Thank you
[Edited at 2019-04-19 19:42 GMT]