拆分 Word 文档并另存为 (.RTF)

Split Word Document and Save as (.RTF)

我有 this VBA code,它通过拆分器 (///) 将 word 文档拆分为多个文档,

Sub SplitNotes(delim As String, strFilename As String)
Dim doc As Document
Dim arrNotes
Dim I As Long
Dim X As Long
Dim Response As Integer
arrNotes = Split(ActiveDocument.Range, delim)
Response = MsgBox("This will split the document into " & UBound(arrNotes) + 1 & " sections.Do you wish to proceed?", 4)
If Response = 7 Then Exit Sub
For I = LBound(arrNotes) To UBound(arrNotes)
If Trim(arrNotes(I)) <> "" Then
X = X + 1
Set doc = Documents.Add
doc.Range = arrNotes(I)
doc.SaveAs ThisDocument.Path & "\" & strFilename & Format(X, "000")
doc.Close True
End If
Next I
End Sub
Sub test()
'delimiter & filename
SplitNotes "///", "Notes "
End Sub

这会将拆分后的文档保存到 (.Docx),我怎样才能将它们保存到 (.Rtf) 中呢?

您可以使用wdFormatRTF保存为RTF格式,即

doc.SaveAs2 ThisDocument.Path & "\" & strFilename & Format(X, "000"), FileFormat:=wdFormatRTF