如何將文檔分成多個單詞?
如果您有大量的Word文檔,需要將其拆分為多個文檔,請花幾分鐘閱讀本教程。 本教程將向您展示兩種將文檔拆分為多個文檔的方法。
使用VBA通過指定的分隔符拆分Word文檔
此方法將引入VBA來通過Word中指定的分隔符將Word文檔拆分,而不是手動將文檔拆分為多個文檔。 請執行以下操作:
1。 按 Alt + F11鍵 鍵一起打開Microsoft Visual Basic for Application窗口;
2。 點擊 插入 > 模塊,然後將以下VBA代碼粘貼到新打開的“模塊”窗口中。
VBA:通過分隔符將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
3。 然後點擊 跑 按鈕或按F5鍵應用VBA。
4。 在彈出的Microsoft Word文檔中,請單擊“是”按鈕繼續。
備註:
(1)確保將分隔符添加為與 “ ///” 在子測試中,您要分隔的每個文本部分之間的文檔。 此外,您可以更改 “ ///” 任何分隔符,以滿足您的需要。
(2)您可以更改文件 “筆記” 在子測試中以滿足您的需求。
(3)分割文件將與原始文件保存在同一位置。
(4)不需要在原始文件的末尾添加定界符,如果這樣做,則分割後將出現空白文檔。
使用VBA按頁面拆分Word文檔
這是另一個VBA,可幫助您在Word中快速將一個Word文檔按頁面拆分成多個。 請執行以下操作:
1。 按 Alt + F11鍵 鍵一起打開Microsoft Visual Basic for Application窗口;
2。 點擊 插入 > 模塊,然後將以下VBA代碼粘貼到新打開的“模塊”窗口中。
VBA:在Word中按頁面將文檔拆分為多個文檔
Sub SplitIntoPages()
Dim docMultiple As Document
Dim docSingle As Document
Dim rngPage As Range
Dim iCurrentPage As Integer
Dim iPageCount As Integer
Dim strNewFileName As String
Application.ScreenUpdating = False 'Makes the code run faster and reduces screen _
flicker a bit.
Set docMultiple = ActiveDocument 'Work on the active document _
(the one currently containing the Selection)
Set rngPage = docMultiple.Range 'instantiate the range object
iCurrentPage = 1
'get the document's page count
iPageCount = docMultiple.Content.ComputeStatistics(wdStatisticPages)
Do Until iCurrentPage > iPageCount
If iCurrentPage = iPageCount Then
rngPage.End = ActiveDocument.Range.End 'last page (there won't be a next page)
Else
'Find the beginning of the next page
'Must use the Selection object. The Range.Goto method will not work on a page
Selection.GoTo wdGoToPage, wdGoToAbsolute, iCurrentPage + 1
'Set the end of the range to the point between the pages
rngPage.End = Selection.Start
End If
rngPage.Copy 'copy the page into the Windows clipboard
Set docSingle = Documents.Add 'create a new document
docSingle.Range.Paste 'paste the clipboard contents to the new document
'remove any manual page break to prevent a second blank
docSingle.Range.Find.Execute Findtext:="^m", ReplaceWith:=""
'build a new sequentially-numbered file name based on the original multi-paged file name and path
strNewFileName = Replace(docMultiple.FullName, ".doc", "_" & Right$("000" & iCurrentPage, 4) & ".doc")
docSingle.SaveAs strNewFileName 'save the new single-paged document
iCurrentPage = iCurrentPage + 1 'move to the next page
docSingle.Close 'close the new document
rngPage.Collapse wdCollapseEnd 'go to the next page
Loop 'go to the top of the do loop
Application.ScreenUpdating = True 'restore the screen updating
'Destroy the objects.
Set docMultiple = Nothing
Set docSingle = Nothing
Set rngPage = Nothing
End Sub
3。 然後點擊 跑 按鈕或按下 F5 應用VBA的關鍵。
備註: 拆分文檔將與原始文件保存在同一位置。
使用Kutools for Word通過標題/頁面/分節符/分頁符拆分Word文檔
如果您安裝了Kutools for Word,則可以應用它 分裂 功能可輕鬆在Word中按頁面,標題,分節符或分頁符將一個文檔拆分為多個文檔。
1。點擊 Kutools 加 > 分裂 使之成為可能 分裂 功能。
2。 在屏幕上打開的“拆分”對話框中,您可以執行以下操作:
(1)從 分割為 下拉列表。
此功能支持6種拆分方式:標題1,分頁符,分節符,頁面,每n頁和自定義頁面範圍,如下面的屏幕截圖所示:
(2)點擊 瀏覽 按鍵 指定 將拆分文檔保存到的目標文件夾;
(3)在關鍵字欄中輸入關鍵字作為新文檔名稱的前綴。 文件前綴 框。
提示:
(1)如果指定拆分當前文檔 每n頁,您需要在 每n頁 框;
(2)如果您指定按自定義頁面範圍分割當前文檔,則需要在這些自定義頁面範圍中輸入用逗號分隔的自定義頁面範圍。 頁 框,例如,在框中鍵入1、3-5、12。
3。 點擊 Ok 按鈕開始拆分。
然後,以指定的拆分方式拆分當前文檔,新文檔將批量保存到目標文件夾中。
分頁瀏覽和編輯多個Word文檔,例如Firefox,Chrome,Internet Explore 10!
您可能很熟悉在Firefox / Chrome / IE中查看多個網頁,並通過輕鬆單擊相應的選項卡在它們之間進行切換。 在這裡,Office選項卡支持類似的處理,使您可以在一個Word窗口中瀏覽多個Word文檔,並通過單擊其選項卡輕鬆在它們之間切換。 單擊可獲得全部功能,免費試用!
相關文章:
推薦的Word生產力工具
Kutools For Word - 超過 100 Word 的高級功能, 節省您的 50% 時間
- 複雜和重複的操作可以在幾秒鐘內完成一次處理。
- 跨文件夾一次將多個圖像插入Word文檔。
- 將文件夾中的多個Word文件合併並合併為所需順序。
- 根據標題,分節符或其他條件將當前文檔拆分為單獨的文檔。
- 在Doc和Docx之間,Docx和PDF之間轉換文件,用於常見轉換和選擇的工具集合等...


























