Word Document
Microsoft Word is a word processor developed by Microsoft where RTF refers to Rich Text Format which is also a word processing application. Following VBA code will process all Word Document and convert them into RTF (Rich Text Format) document:
Code example
Sub ConvertDocxToRTF() With Application.FileDialog(msoFileDialogFolderPicker) .Title = "Select folder..." .Show If .SelectedItems.Count = 0 Then Exit Sub Else myFolder = .SelectedItems.Item(1) End If End With myWildCard = InputBox(prompt:="Enter wild card...") myDocs = Dir(myFolder & "\" & myWildCard) While myDocs <> "" Documents.Open FileName:=myFolder & "\" & myDocs, ConfirmConversions:=False ActiveDocument.SaveAs2 FileName:=myFolder & "\" & Left(myDocs, Len(myDocs) - 4) & ".rtf", _ FileFormat:=wdFormatRTF ActiveDocument.Close SaveChanges:=False myDocs = Dir() Wend MsgBox "Operation Complete" End Sub
The wildcard input should go as “*.doc“