Перейти к основному содержанию

Как в Word разбить документ на несколько документов?

Если у вас есть объемный текстовый документ, который вам нужно разделить на несколько документов, уделите несколько минут, чтобы прочитать это руководство. Это руководство покажет вам два метода разделения документа на несколько документов.


Разделить документ Word по указанному разделителю с помощью VBA

Вместо разделения документа на несколько документов вручную этот метод вводит VBA для разделения документа Word по указанному разделителю в Word. Пожалуйста, сделайте следующее:

1, нажмите Alt + F11 вместе, чтобы открыть окно Microsoft Visual Basic для приложения;

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. Затем нажмите Run или нажмите клавишу F5, чтобы применить VBA.

4. Во всплывающем документе Microsoft Word нажмите кнопку Да, чтобы продолжить.

Примечание:
(1) Обязательно добавьте разделитель, как и "///" во вспомогательном тесте документа между каждым разделом текста, который вы хотите отделить. Также вы можете изменить "///" к любым разделителям, чтобы удовлетворить ваши потребности.
(2) Вы можете изменить документы "Заметки" в дополнительном тесте в соответствии с вашими потребностями.
(3) И разделенные документы будут сохранены в том же месте, что и исходный файл.
(4) Вам не нужно добавлять разделитель в конец исходного файла, если вы это сделаете, после разделения будет пустой документ.

Разделить документ Word по страницам с помощью VBA

Вот еще один VBA, который поможет вам быстро разделить один документ Word на несколько страниц в Word. Пожалуйста, сделайте следующее:

1, нажмите Alt + F11 вместе, чтобы открыть окно Microsoft Visual Basic для приложения;

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. Затем нажмите Run или нажмите F5 ключ для применения VBA.

Примечание: Разделенные документы будут сохранены в том же месте, что и исходный файл.


Разделить документ Word по заголовку / странице / разрыву раздела / разрыву страницы с помощью Kutools for Word

Если у вас установлен Kutools for Word, вы можете применить его Split функция, позволяющая легко разделить один документ на несколько по странице, заголовку, разрыву раздела или разрыва страницы, как вам нужно в Word ..

Kutools for Word — это идеальная надстройка Word, которая оптимизирует вашу работу и повышает ваши навыки обработки документов. Попробуйте БЕСПЛАТНО за 60 дней! Получи это сейчас!

1.Щелкните Кутулс Плюс > Split для Split функцию.

2. В открывшемся диалоговом окне Разделить на экране вы можете сделать следующее:

(1) Выберите способ разделения из Разделить на выпадающий список.
Эта функция поддерживает 6 способов разделения: заголовок 1, разрывы страниц, разрывы разделов, страницы, каждые n страниц и настраиваемые диапазоны страниц, как показано ниже:

(2) Щелкните значок ЛИСТАТЬ СПИСКИ кнопка  указать папку назначения, в которую вы сохраните разделенные документы;

(3) Введите ключевое слово в качестве префикса имен новых документов в поле Префикс документа пунктом.

Советы:
(1) Если вы укажете разделение текущего документа по Каждые n страниц, вам нужно указать номер в Каждые n страниц коробка;

(2) Если вы укажете разделение текущего документа по настраиваемым диапазонам страниц, вам необходимо ввести эти настраиваемые диапазоны страниц через запятую в поле страница box, например, введите 1, 3-5, 12 в поле.

3, Нажмите Ok кнопку, чтобы начать разделение.

Затем текущий документ разделяется указанным способом разделения, и новые документы будут сохраняться в целевую папку сразу.

Просмотр и редактирование нескольких документов Word с вкладками в Firefox, Chrome, Internet Explore 10!

Возможно, вы знакомы с просмотром нескольких веб-страниц в Firefox / Chrome / IE и возможностью переключения между ними, легко щелкая соответствующие вкладки. Здесь вкладка Office поддерживает аналогичную обработку, которая позволяет просматривать несколько документов Word в одном окне Word и легко переключаться между ними, щелкая их вкладки. Нажмите, чтобы получить полную бесплатную пробную версию!
Просматривайте несколько документов Word в одном окне как Firefox


Относительные статьи:


Лучшие инструменты для офисной работы

Kutools for Word - Повысьте свой опыт работы со словом с помощью Over 100 Замечательные особенности!

🤖 Kutools AI Помощник: Преобразуйте свое письмо с помощью искусственного интеллекта. Создать контент  /  Переписать текст  /  Обобщение документов  /  Запросить информацию на основе документа, все в Word

📘 Владение документами: Разделить страницы  /  Объединить документы  /  Экспортировать выбранное в различные форматы (PDF/TXT/DOC/HTML...)  /  Пакетное преобразование в PDF  /  Экспортировать страницы как изображения  /  Печать нескольких файлов одновременно...

Редактирование содержания: Пакетный поиск и замена через несколько файлов  /  Изменить размер всех изображений  /  Транспонировать строки и столбцы таблицы  /  Преобразовать таблицу в текст...

🧹 Легкая очистка: Убрать Дополнительные места  /  Разрывы разделов  /  Все заголовки  /  Текстовые поля  /  Гиперссылки  / Чтобы получить дополнительные инструменты для удаления, посетите наш Удалить группу...

Креативные вставки: Вставлять Разделители тысяч  /  Флажки  /  радио кнопки  /  QR код  /  Штрих-код  /  Таблица диагональных линий  /  Заголовок уравнения  /  Заголовок изображения  /  Заголовок таблицы  /  Несколько изображений  / Узнайте больше в Вставить группу...

???? Точный выбор: Точно определить конкретные страницы  /  Эта таблица  /  формы  /  заголовки абзацев  / Улучшите навигацию с помощью БОЛЕЕ Выберите функции...

Звездные улучшения: Быстро перемещайтесь в любое место  /  автоматическая вставка повторяющегося текста  /  плавно переключаться между окнами документов  /  11 инструментов преобразования...

👉 Хотите попробовать эти функции? Kutools for Word предлагает 60-дневная бесплатная пробная версия, без ограничений! 🚀
 
Comments (45)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
VBA: Split Document into Multiple Documents by Page in Word - in this when we run it, outcome comes in portrait layout only. If original doc is in landscape then full data of the original doc does not come in the pages breaked by this vba.. There must be seperate vba for portrait and landscape docs.
This comment was minimized by the moderator on the site
I use the "split"-function of "Kutools For Word 9.00" with "header 1" and it works for 48 documents and then it simply stops without any message, as if it wohl have been finished. But I have 700 "header 1" in a 2000 pages document!
Is it simply too much for the tool or is there any other reason?
This comment was minimized by the moderator on the site
your code add new blank page in every page
This comment was minimized by the moderator on the site
This worked fine up until yesterday with Office365, but now I constantly get a runtime error '4605' stating this command is not available. Sometimes at the first page, sometimes at the 3rd page...I can't make it past 3 pages anymore. It happens with line 28 above...

docSingle.Range.Paste 'paste the clipboard contents to the new document
This comment was minimized by the moderator on the site
I've got this error too - Did you get anywhere with it?


Thanks
This comment was minimized by the moderator on the site
yes...i have to run it on the local hard drive. if i run it on a network file or with RemotePC it. has something to do with the script having to wait too long in between commands and it errors out copy and pasting to the clipboard. hope that helps!!
This comment was minimized by the moderator on the site
I copied the document distribution macro 'Split Word Document By Specified Delimiter With VBA', but in the line of 'sub test', the software reads it as a new macro and there are two macros here.
This comment was minimized by the moderator on the site
The script saves a two pages document, the second is total blank.

How to solve this?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
I am working on this as well but have not found a way to do it besides manually.
This comment was minimized by the moderator on the site
Does not work at all for me. Goes through the motions but no documents are saved. Maybe because I am using .DOCX files?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
Maybe something to do with Windows 7 settings? Thoughts from anyone?
This comment was minimized by the moderator on the site
Mais comment garder une mise en page complexe (image de fond, marges, etc) ?
Great but how to keep the lay-out (background image, margins ?)
This comment was minimized by the moderator on the site
Can you split the document based on Heading 1 styles as your "delimiter".
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
Downloaded fodler doesnt open at all. Waiting for a long time.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations