提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何将文档分成多个文档?

如果您需要将大量的Word文档分成多个文档,请花几分钟阅读本教程。 本教程将向您展示将文档分成多个文档的两种方法。

用VBA指定的分隔符分割Word文档

用VBA分页Word文档

通过标题/页面/分节符/分页符使用Kutools for Word分割Word文档

轻松将一个Word文档分割为多个页面,分段/分页符或标题一次!

与通过复制粘贴来分割Word文档相比,Kutools for Word将帮助您轻松地工作,并通过Split功能显着提高工作效率,Split功能可以快速将当前打开的Word文档分割为多个页面,分段分隔,逐页或者根据需要使用Heading 1。 点击60天免费试用!
广告按页面分割文档


箭头蓝色右泡 用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文档分成多个页面。 请做如下:

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文档

如果你安装了Word的Kutools,你可以应用它 分裂 函数轻松地将一个文档分成多个页面,标题,分节符或分页符,因为您需要在Word中..

Kutools for Word 是一个方便的插件,可以简化您的工作并提高您处理word文档的能力。 45天免费试用! 现在得到它!

1。 点击 Kutools Plus > 分裂 启用分割功能。
doc拆分文档001

2。 请在屏幕中打开Split对话框 (1) 指定您将保存拆分文档的目标文件夹, (2) 检查标准,你将分裂从 拆分 下拉列表,和(3)点击 OK 按钮。 看截图:

而现在当前的Word文档被拆分指定的标准(在我的情况下标题1),并且目标文件夹自动打开与拆分文档。 看截图:
doc拆分文档002

请注意: 这个梦幻般的分割功能还支持按页面分页一个Word文档,通过分页符,并在Word中轻松地分节。 看下面的截图:

将一个Word文档分割成多个页面:

通过分页符将一个Word文档拆分为多个:

将一个Word文档按分节符拆分为多个:

浏览和编辑多个Word文档为Firefox,Chrome,Internet浏览10!

您可能熟悉在Firefox / Chrome / IE中查看多个网页,并通过轻松点击相应的标签来切换它们。 在这里,Office选项卡支持类似的处理,允许您在一个Word窗口中浏览多个Word文档,并通过单击它们的选项卡轻松切换它们。 点击查看完整功能免费试用!
在一个窗口中以Firefox浏览多个单词文档


箭头蓝色右泡相关文章:

合并多个文件并保持格式




推荐的Word生产力工具

Kutools For Word - 超过100 Word的高级功能,节省您的50%时间

  • 复杂和重复的操作可以在几秒钟内完成一次性处理。
  • 一次将多个图像跨文件夹插入Word文档。
  • 将多个文件夹合并并组合成一个具有所需订单的文件。
  • 根据标题,分节符或其他标准将当前文档拆分为单独的文档。
  • 在Doc和Docx,Docx和PDF之间转换文件,用于常见转换和选择的工具集合等等......
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Jorge · 2 months ago
    The script saves a two pages document, the second is total blank.

    How to solve this?
    • To post as a guest, your comment is unpublished.
      kellytte · 1 months ago
      Hi Jorge,
      The VBA script introduced splits document by the separator “///”, and you do not need to add delimiter to the end of the original file, if you do, there will be a blank document after splitting.
      • To post as a guest, your comment is unpublished.
        Lisa · 15 days ago
        Hi kellytte, Could you please explain a little further? I copy and paste the VBA script under the "Split Word by Document with VBA" from above and after I run the process following the instructions above, I always have to manually delete a 2nd blank page on each of the new documents that were created. Are you saying there is something that needs to be removed from the VBA script that will cause this to stop?
  • To post as a guest, your comment is unpublished.
    Maya · 7 months ago
    The split works great for me but on page in the merge file turns into 1.5 pages - something with the page layout (+ additional empty page at the end). any ideas how to go around that?
  • To post as a guest, your comment is unpublished.
    Lisa · 1 years ago
    The Split Word By Document with VBA worked for me, but it is adding a blank page at the end of each document. Is there a way around this?
    • To post as a guest, your comment is unpublished.
      Savvyno · 7 months ago
      I am working on this as well but have not found a way to do it besides manually.
    • To post as a guest, your comment is unpublished.
      Steve · 11 months ago
      Does not work at all for me. Goes through the motions but no documents are saved. Maybe because I am using .DOCX files?
      • To post as a guest, your comment is unpublished.
        Savvy · 7 months ago
        After playing with this code for over an hour I discovered you have to save the document you mail merged then you can run the code on the saved document that has all the pages you need to split up. Hope this helps.
        • To post as a guest, your comment is unpublished.
          Steve · 7 months ago
          I always start with a newly-saved document. I found the split documents were actually saved somewhere (I forget; doesn't matter) they were text only - all the formatting had been dropped.
      • To post as a guest, your comment is unpublished.
        Steve · 11 months ago
        Maybe something to do with Windows 7 settings? Thoughts from anyone?
  • To post as a guest, your comment is unpublished.
    Fenice · 1 years ago
    Mais comment garder une mise en page complexe (image de fond, marges, etc) ?
    Great but how to keep the lay-out (background image, margins ?)
  • To post as a guest, your comment is unpublished.
    Andrew · 1 years ago
    Can you split the document based on Heading 1 styles as your "delimiter".
    • To post as a guest, your comment is unpublished.
      kellytte · 8 months ago
      Hi Andrew,
      The VBA script can split the entire document by page. If you need to split by heading 1, we suggest to try Kutools for Word’s Split (Document) feature.
  • To post as a guest, your comment is unpublished.
    SHUBAM AWASTHI · 1 years ago
    i need to split the document using page range. for example i wanted to split 1 to 10 page in another document. how i can do it
  • To post as a guest, your comment is unpublished.
    raid3n06 · 1 years ago
    like individual merge add ons
    • To post as a guest, your comment is unpublished.
      kelly001 · 1 years ago
      The Split (Document) feature of Kutools for Word can help users to split a Word document by heading 1, page break, section break, or page.
      In addition, Kutools for Word also includes Merge feature to merge multiple Word documents into one.
  • To post as a guest, your comment is unpublished.
    Jason · 1 years ago
    I used the code from the "Split Word Document By Page With VBA" section. How should I amend the code in order to maintain the original header in all of the new files?
  • To post as a guest, your comment is unpublished.
    Erica · 1 years ago
    I used the code from the "Split Word Document By Page With VBA" section. It worked to split the documents out but messed up the formatting - causing what should have been on 2 pages to be on 5 instead. I played around with the code and ended up finding a solution.


    I replaced this line: docSingle.Range.Paste 'paste the clipboard contents to the new document

    with this line: docSingle.Range.PasteAndFormat (wdFormatOriginalFormatting)

    Hope this helps some of you who've had formatting issues.
  • To post as a guest, your comment is unpublished.
    Michal · 1 years ago
    Thanks !

    One question do You have any idea to save all the split documents into PDF ?
  • To post as a guest, your comment is unpublished.
    Tjebbe · 2 years ago
    You just saved me a Sh*t load of time, thanks!
  • To post as a guest, your comment is unpublished.
    Prince · 2 years ago
    Thank you, this was very helpful!
  • To post as a guest, your comment is unpublished.
    Ramin · 2 years ago
    Thanks for the macro code
  • To post as a guest, your comment is unpublished.
    LK · 2 years ago
    I did the VBA Code: split document into multiple documents according to delimiter, it does split the document but unfortunately the graphics are deleted, also formatting. Is there a solution to this?
  • To post as a guest, your comment is unpublished.
    Panos HalfMan · 2 years ago
    Does anyone knows how to change the name of the files after splitting the main one

    I want to change the names according to Header of the file
  • To post as a guest, your comment is unpublished.
    Geo. Kelley · 2 years ago
    Forget it, I tried several times with the letters numbers, which did not work, then I seen it erased my comments.

    Just to note the first code did not work for me, it said it was breaking the document into three sections, but did not.
  • To post as a guest, your comment is unpublished.
    Geo. Kelley · 2 years ago
    I tried the first split document code and it did not work. It said it was breaking it into three sections, but it did not.
    • To post as a guest, your comment is unpublished.
      · 2 years ago
      The first VBA will split the current document by delimiter "///". Did you add the split delimiter "///" in you document?
  • To post as a guest, your comment is unpublished.
    Phil Smith · 2 years ago
    Your macro works [b]REALLY[/b] well, however, I require the split documents to retain their narrow margins and two coluimn layout. More by luck than judgement(!), I managed to achieve this manually and the end result was exactly as I required. I then used the macro recorder but do not have the knowledge of Word VBA to alter the recorded code to achieve this. Can you help? Thanks in advance!
  • To post as a guest, your comment is unpublished.
    David Fuller · 2 years ago
    Too hard for a pensioner to comprehend what happened to the old way I windows seven that program was so easy for us older people to follow.
  • To post as a guest, your comment is unpublished.
    JP · 3 years ago
    Unfortunately, I can't split pages with Kutools. What can I do? I get this error message:

    Informationen über das Aufrufen von JIT-Debuggen
    anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

    ************** Ausnahmetext **************
    System.NotSupportedException: Das angegebene Pfadformat wird nicht unterstützt.
    bei System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
    bei System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
    bei System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
    bei System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
    bei System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
    bei System.IO.Directory.CreateDirectory(String path)
    bei Kutools.FormDocumentSplit.€()
    bei Kutools.FormDocumentSplit.›(Object “, EventArgs ”)
    bei System.Windows.Forms.Control.OnClick(EventArgs e)
    bei System.Windows.Forms.Button.OnClick(EventArgs e)
    bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    bei System.Windows.Forms.Control.WndProc(Message& m)
    bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
    bei System.Windows.Forms.Button.WndProc(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  • To post as a guest, your comment is unpublished.
    Diane · 3 years ago
    Very helpful thank you!

    My original document had 'read only' set. This is not transferring into the new documents. Is this possible to add?
    • To post as a guest, your comment is unpublished.
      · 2 years ago
      Kutools for Word does not work for read-only documents.
  • To post as a guest, your comment is unpublished.
    Kotieddy · 3 years ago
    Dear team,
    VBA for Splitting document into multiple single-paged document is working good, but the problem is split documents are not having the table formats.(table formats in master document are not formatted as table in split documents).
    Thanks in advance if i can get the macros, so that tabular formats in master document are not disturbed in split documents
  • To post as a guest, your comment is unpublished.
    Ilya · 4 years ago
    Hello. How I can split .doc not one page per document using these scripts? E.g. 10 or 5 pages per document
  • To post as a guest, your comment is unpublished.
    Dhamo · 5 years ago
    When i try to split document the word document by using the above VB code, Its splitting by removing all the images and inseterd objects.
    • To post as a guest, your comment is unpublished.
      Tom Saylor · 3 years ago
      I'm having a problem similar to Dhamo's. I started with a large file with many embedded content controls. When I split my Word file using the VB code, the content controls were all converted to regular text. Is there any way to split a file without losing the formatting of the original?