如何将文档分成多个单词?
如果您有一个庞大的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 Tab支持类似的处理,它允许您在一个Word窗口中浏览多个Word文档,并通过单击它们的选项卡轻松地在它们之间切换。 单击可获得全部功能,免费试用!
相关文章:
最佳办公生产力工具
Kutools for Word - 通过 Over 提升您的文字体验 100 显着特点!
🤖 Kutools 人工智能助手:用人工智能改变你的写作 - 生成内容 / 重写文本 / 总结文件 / 查询资料 基于文档,全部在Word中
📘 文档掌握: 分页 / 合并文件 / 以各种格式导出选择(PDF/TXT/DOC/HTML...) / 批量转换为PDF / 将页面导出为图像 / 一次打印多个文件...
✏ 内容编辑: 批量查找和替换 跨多个文件 / 调整所有图片的大小 / 转置表行和列 / 将表格转换为文字...
🧹 轻松清洁: 移开 多余的空间 / 分节符 / 所有标题 / 文本框 / 超链接 / 如需更多拆卸工具,请前往我们的 删除组...
➕ 创意插入: 插 千位分隔符 / 复选框 / 单选按钮 / 扫码支付 / 条码 / 对角线表 / 公式标题 / 图片说明 / 表标题 / 多张图片 / 发现更多 插入组...
🔍 精准选择:精确定位 特定页面 / 表 / 形状 / 标题段落 / 增强导航功能 更多 选择功能...
⭐ 星级增强: 快速导航至任何位置 / 自动插入重复文本 / 在文档窗口之间无缝切换 / 11 转换工具...