如何将文档分成多个单词?
如果您有一个庞大的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之间转换文件,用于常见转换和选择的工具集合等...


























