Прескочи на основното съдържание

Как да разделя документ на няколко документа в Word?

Автор: Аманда Ли Последна промяна: 2020-12-23

Ако имате масивен Word документ, който трябва да разделите на няколко документа, отделете няколко минути, за да прочетете този урок. Този урок ще ви покаже два метода за разделяне на документ на множество документи.


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

Вместо ръчно разделяне на документ на множество документи, този метод ще въведе 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) Не е необходимо да добавяте разделител в края на оригиналния файл, ако го направите, след разделянето ще има празен документ.

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

Ето още един 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.

Забележка: Разделените документи ще бъдат запазени на същото място с оригиналния файл.


Разделете документ на Word чрез заглавие/страница/прекъсване на раздел/разделяне на страница с помощта на Kutools за Word

Ако имате инсталиран Kutools за Word, можете да го приложите разцепен функция за лесно разделяне на един документ на няколко по страница, заглавие, прекъсване на раздел или страница, както ви е необходимо в Word.

Kutools за Word е най-добрата добавка за Word, която рационализира работата ви и повишава уменията ви за обработка на документи. Опитайте го БЕЗПЛАТНО за 60 дни! Вземи го сега!

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 и лесно да превключвате между тях, като щраквате върху техните раздели. Щракнете за пълен пробен период!
Разглеждайте множество текстови документи в един прозорец като Firefox


Сродни статии:


Най-добрите инструменти за продуктивност в офиса

Kutools за Word - Подобрете своя Word опит с Over 100 Забележителни функции!

🤖 Kutools AI Assistant: Преобразувайте писането си с AI - Генериране на съдържание  /  Пренаписване на текст  /  Обобщаване на документи  /  Запитване за информация въз основа на Документ, всичко това в Word

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

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

🧹 Почистване без усилие: Изметете Допълнителни пространства  /  Прекъсвания на раздели  /  Всички заглавки  /  Текстови полета  /  Хипервръзки  / За повече инструменти за премахване се насочете към нашия Премахване на група...

Творчески вложки: Вмъкване Хилядни разделители  /  Квадратчета  /  Радио бутони  /  QR Code  /  Баркод  /  Таблица с диагонални линии  /  Надпис на уравнение  /  Надпис на изображението  /  Надпис на таблица  /  Множество снимки  / Открийте повече в Вмъкване на група...

🔍 Прецизни селекции: Точна точка конкретни страници  /  таблици  /  форми  /  заглавни параграфи  / Подобрете навигацията с още Изберете функции...

Звездни подобрения: Навигирайте бързо до всяко място  /  автоматично вмъкване на повтарящ се текст  /  безпроблемно превключване между прозорците на документи  /  11 Инструменти за конвертиране...

👉 Искате ли да изпробвате тези функции? Kutools за Word предлага a 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