Hoppa till huvudinnehåll

Hur delar jag upp dokument i flera dokument i ord?

Om du har ett massivt orddokument som du behöver dela upp i flera dokument, ta några minuter att läsa denna handledning. Denna handledning visar dig två metoder för att dela upp ett dokument i flera dokument.


Dela Word-dokument med angiven avgränsare med VBA

Istället för att dela upp dokument i flera dokument manuellt, kommer den här metoden att introducera en VBA för att dela ett Word-dokument med den angivna avgränsaren i Word. Gör så här:

1. Tryck Alt + F11 tangenter tillsammans för att öppna fönstret Microsoft Visual Basic for Application;

2. Klicka Insert > Modulernaoch klistra sedan in under VBA-koden i det nya öppningsmodulfönstret.

VBA: Dela Word-dokument i flera dokument av avgränsare

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. Klicka sedan Körning eller tryck på F5-tangenten för att tillämpa VBA.

4. Klicka på Ja-knappen för att fortsätta genom att klicka på Microsoft Word-dokumentet.

Notera:
(1) Var noga med att lägga till din avgränsare som samma som "///" i delprovet till dokumentet mellan varje textavsnitt du vill separera. Du kan också ändra "///" till eventuella avgränsare för att tillgodose ditt behov.
(2) Du kan ändra dokumenten "Notes" i underprovet för att passa dina behov.
(3) Och delningsdokumenten kommer att sparas på samma plats med originalfilen.
(4) Du behöver inte lägga till avgränsare i slutet av originalfilen. Om du gör det kommer det att finnas ett tomt dokument efter delningen.

Dela Word-dokument för sida med VBA

Här är en annan VBA som hjälper dig att snabbt dela ett Word-dokument till flera för sida i Word. Gör så här:

1. Tryck Alt + F11 tangenter tillsammans för att öppna fönstret Microsoft Visual Basic for Application;

2. Klicka Insert > Modulernaoch klistra sedan in under VBA-koden i det nya öppningsmodulfönstret.

VBA: Dela upp dokument i flera dokument per sida i 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. Klicka sedan Körning knappen eller tryck på F5 för att tillämpa VBA.

Notera: Delningsdokumenten sparas på samma plats med originalfilen.


Dela Word-dokument med rubrik / sida / sektionsbrytning / sidbrytning med hjälp av Kutools för Word

Om du har Kutools för Word installerat kan du använda det Split funktion för att enkelt dela upp ett dokument i flera dokument efter sida, rubrik, sektionsbrytning eller sidbrytning som du behöver i Word ..

Kutools för Word är det ultimata Word-tillägget som effektiviserar ditt arbete och ökar dina färdigheter i dokumentbehandling. Prova det GRATIS för 60 dagar! Hämta den nu!

1.Klick Kutools Plus > Split för att aktivera Split särdrag.

2. I öppningsdialogrutan på skärmen kan du göra följande:

(1) Välj det delande sättet från Dela med listrutan.
Den här funktionen stöder 6 uppdelningsmetoder: rubrik 1, sidbrytningar, sektionsbrytningar, sidor, varje n-sida och anpassade sidområden enligt nedanstående skärmdump:

(2) Klicka på Bläddra Knappen  för att specificera målmappen du sparar de delade dokumenten till;

(3) Skriv in ett nyckelord som prefix för nya dokumentnamn i Dokumentprefix låda.

Tips:
(1) Om du anger att dela det aktuella dokumentet med Varje n sidamåste du ange numret i Varje n sida låda;

(2) Om du anger att dela det aktuella dokumentet efter anpassade sidområden måste du ange dessa anpassade sidområden åtskilda av kommatecken i Sida rutan, till exempel, skriv 1, 3-5, 12 i rutan.

3. Klicka på Ok för att börja dela.

Därefter delas det aktuella dokumentet på det angivna delnings sättet och nya dokument sparas i målmappen i bulk.

Tabbad surfning och redigering av flera Word-dokument som Firefox, Chrome, Internet Explore 10!

Du kanske är bekant att visa flera webbsidor i Firefox / Chrome / IE och växla mellan dem genom att enkelt klicka på motsvarande flikar. Här stöder Office Tab liknande bearbetning, som låter dig bläddra i flera Word-dokument i ett Word-fönster och enkelt växla mellan dem genom att klicka på deras flikar. Klicka för fullständiga funktioner gratis provperiod!
Bläddra i flera orddokument i ett fönster som Firefox


Relativa artiklar:


Bästa kontorsproduktivitetsverktyg

Kutools för Word - Höj din ordupplevelse med Over 100 Anmärkningsvärda funktioner!

🤖 Kutools AI Assistant: Förvandla ditt skrivande med AI - Generera innehåll  /  Skriv om text  /  Sammanfatta dokument  /  Fråga för information baserat på dokument, allt i Word

📘 Dokumentbehärskning: Dela sidor  /  Sammanfoga dokument  /  Exportera urval i olika format (PDF/TXT/DOC/HTML...)  /  Batchkonvertera till PDF  /  Exportera sidor som bilder  /  Skriv ut flera filer samtidigt...

Innehållsredigering: Batch Hitta och ersätt över flera filer  /  Ändra storlek på alla bilder  /  Transponera tabellrader och kolumner  /  Konvertera tabell till text...

🧹 Enkel rengöring: Svep bort Extra utrymmen  /  Avsnitt bryter  /  Alla rubriker  /  Textrutor  /  Hyperlänkar  / För fler borttagningsverktyg, gå till vår Ta bort gruppen...

Kreativa inlägg: Föra in Tusen avskiljare  /  Kryssrutor  /  radio Knappar  /  QR-kod  /  Streckkod  /  Diagonal linjebord  /  Bildtext för ekvation  /  Bild Bildtext  /  Tabelltextning  /  Flera bilder  / Upptäck mer i Infoga grupp...

🔍 Precisionsval: Precisera specifika sidor  /  Tabellerna  /  former  /  rubrikerna  / Förbättra navigering med mer Välj funktioner...

Stjärnförbättringar: Navigera snabbt till vilken plats som helst  /  infoga repetitiv text automatiskt  /  växla sömlöst mellan dokumentfönster  /  11 Konverteringsverktyg...

👉 Vill du prova dessa funktioner? Kutools för Word erbjuder en 60-dagars gratis försök, utan begränsningar! 🚀
 
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