-3
私は、1つのMS Word文書をカスタム区切り文字を使用して複数に分割します。私はMS Word形式で複数のファイルを作成することができますが、代わりに複数の.txtファイルを作成したいと思います。マクロを使用してWord文書を複数の.txtファイルに分割する
私が今使っているコードは次のとおりです。
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
は、誰もがこれで私を助けてくださいことはできますか?
あなたはファイル形式ではありません。 「SaveAsAOCELetter」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、「エンコード」、 ]、[InsertLineBreaks]、[AllowSubstitutions]、[LineBinding]、[AddBiDiMarks]) – ACatInLove
何とか修正していただけますか?私はコーディングがうまくいかない。 –
私は複数のものは必要ありません。ファイルは.txt形式で保存する必要があります。 WORD文書にもテキストが含まれているためです。しかし、特別なフォーマットはありません。 –