-3
단일 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', [SaveAsAOCELetter], [SaveAsAOCELetter], [SaveAsAOCELetter], [SaveAsAOCELetter], [SaveAsAOCELetter], [SaveAsAOCELetter], [SaveAsAOCELetter] ], [InsertLineBreaks], [AllowSubstitutions], [LineEnding], [AddBiDiMarks]) – ACatInLove
어떻게 든 고칠 수 있습니까? 나는 코딩에 능숙하지 않다. –
여러 가지가 필요하지 않습니다. 파일은 .txt로 저장해야합니다. Word 문서에는 텍스트도 포함되어 있습니다. 특별한 포맷팅은 없습니다. –