Skip i'r prif gynnwys

Sut i rannu dogfen yn sawl dogfen mewn gair?

Os oes gennych ddogfen eiriau enfawr y mae angen i chi ei rhannu'n sawl dogfen, cymerwch ychydig funudau i ddarllen y tiwtorial hwn. Bydd y tiwtorial hwn yn dangos dau ddull i chi ar gyfer rhannu dogfen yn sawl dogfen.


Hollti dogfen Word gan amffinydd penodedig gyda VBA

Yn lle rhannu dogfen yn sawl dogfen â llaw, bydd y dull hwn yn cyflwyno VBA i rannu dogfen Word â'r amffinydd penodedig yn Word. Gwnewch fel a ganlyn:

1. Gwasgwch Alt + F11 allweddi gyda'i gilydd i agor ffenestr Microsoft Visual Basic for Application;

2. Cliciwch Mewnosod > Modiwlau, ac yna pastiwch islaw cod VBA i mewn i ffenestr y Modiwl agoriadol newydd.

VBA: Rhannwch Ddogfen Word yn Ddogfennau Lluosog gan Delimiter

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. Yna cliciwch Run botwm neu pwyswch allwedd F5 i gymhwyso'r VBA.

4. Yn y ddogfen popping allan Microsoft Word, cliciwch y botwm Ie i fynd ymlaen.

Nodyn:
(1) Gwnewch yn siŵr eich bod yn ychwanegu eich amffinydd yr un peth â "///" yn yr is-brawf i'r ddogfen rhwng pob adran o'r testun yr ydych am ei wahanu. Hefyd, gallwch chi newid "///" i unrhyw amffinyddion i ddiwallu'ch angen.
(2) Gallwch chi newid y dogfennau "Nodiadau" yn yr is Brawf i weddu i'ch anghenion.
(3) A bydd y dogfennau hollti yn cael eu cadw i'r un lle â'r ffeil wreiddiol.
(4) Nid oes angen i chi ychwanegu amffinydd at ddiwedd y ffeil wreiddiol, os gwnewch hynny, bydd dogfen wag ar ôl ei hollti.

Hollti dogfen Word yn ôl tudalen gyda VBA

Dyma VBA arall i'ch helpu chi i rannu un ddogfen Word yn lluosog i luosog yn ôl tudalen yn Word. Gwnewch fel a ganlyn:

1. Gwasgwch Alt + F11 allweddi gyda'i gilydd i agor ffenestr Microsoft Visual Basic for Application;

2. Cliciwch Mewnosod > Modiwlau, ac yna pastiwch islaw cod VBA i mewn i ffenestr y Modiwl agoriadol newydd.

VBA: Rhannwch Ddogfen yn Ddogfennau Lluosog yn ôl Tudalen yn 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. Yna cliciwch Run botwm neu wasg F5 allwedd i gymhwyso'r VBA.

Nodyn: Bydd y dogfennau hollti yn cael eu cadw i'r un lle â'r ffeil wreiddiol.


Rhannwch ddogfen Word trwy bennawd / tudalen / toriad adran / toriad tudalen gyda defnyddio Kutools ar gyfer Word

Os oes gennych chi Kutools ar gyfer Word wedi'i osod, gallwch chi gymhwyso ei Hollti swyddogaeth i rannu un ddogfen yn hawdd yn un lluosog yn ôl tudalen, pennawd, toriad adran, neu doriad tudalen fel sydd ei angen arnoch yn Word.

Kutools am Word yw'r ychwanegiad Word eithaf sy'n symleiddio'ch gwaith ac yn rhoi hwb i'ch sgiliau prosesu dogfennau. Rhowch gynnig arni AM DDIM ar gyfer 60 dyddiau! Ei gael Nawr!

1. Clic Kutools Byd Gwaith > Hollti i alluogi'r Hollti nodwedd.

2. Yn y dialog Hollti agoriadol yn y sgrin, gallwch wneud fel a ganlyn:

(1) Dewiswch y ffordd hollti o'r Wedi'i rannu gan rhestr ostwng.
Mae'r nodwedd hon yn cefnogi 6 ffordd hollti: pennawd 1, seibiannau tudalen, seibiannau adran, tudalennau, pob n tudalen, ac ystodau tudalen arfer fel y dangosir isod y llun:

(2) Cliciwch y Pori botwm  i nodi y ffolder cyrchfan y byddwch yn arbed y dogfennau rhanedig ynddo;

(3) Teipiwch allweddair i mewn fel rhagddodiad enwau dogfennau newydd yn y Rhagddodiad Dogfen blwch.

Awgrym:
(1) Os ydych chi'n nodi'r rhaniad, rhannwch y ddogfen gyfredol â Pob n tudalen, mae angen i chi nodi'r rhif yn y Pob n tudalen blwch;

(2) Os ydych chi'n nodi rhannu'r ddogfen gyfredol yn ôl ystodau tudalennau arfer, mae angen i chi nodi'r ystodau tudalennau arfer hyn sydd wedi'u gwahanu gan atalnodau yn y tudalen blwch, er enghraifft, math 1, 3-5, 12 yn y blwch.

3. Cliciwch y Ok botwm i ddechrau hollti.

Yna mae'r ddogfen gyfredol yn cael ei rhannu â'r ffordd hollti benodol, a bydd dogfennau newydd yn cael eu cadw i'r ffolder cyrchfan mewn swmp.

Pori tabbed a golygu sawl dogfen Word fel Firefox, Chrome, Internet Explore 10!

Efallai y byddwch yn gyfarwydd i weld tudalennau gwe lluosog yn Firefox/Chrome/IE, a newid rhyngddynt drwy glicio tabiau cyfatebol yn hawdd. Yma, mae Office Tab yn cefnogi prosesu tebyg, sy'n caniatáu ichi bori sawl dogfen Word mewn un ffenestr Word, a newid yn hawdd rhyngddynt trwy glicio ar eu tabiau. Cliciwch i gael treial am ddim nodweddion llawn!
Porwch ddogfennau sawl gair mewn un ffenestr fel Firefox


Erthyglau cymharol:


Offer Cynhyrchiant Swyddfa Gorau

Kutools am Word - Dyrchafu Eich Profiad Word gyda Dros 100 Nodweddion Rhyfeddol!

🤖 Cynorthwy-ydd Kutools AI: Trawsnewidiwch eich ysgrifennu gydag AI - Cynhyrchu Cynnwys  /  Ailysgrifennu Testun  /  Crynhoi Dogfennau  /  Ymholwch am Wybodaeth yn seiliedig ar Ddogfen, i gyd o fewn Word

📘 Meistrolaeth Dogfen: Tudalennau Hollti  /  Uno Dogfennau  /  Dewis Allforio mewn Fformatau Amrywiol (PDF/TXT/DOC/HTML...)  /  Trosi swp i PDF  /  Allforio Tudalennau fel Delweddau  /  Argraffu Ffeiliau Lluosog ar unwaith...

Golygu Cynnwys: Swp Dod o Hyd i ac Amnewid ar draws Ffeiliau Lluosog  /  Newid Maint Pob Llun  /  Trawsosod Rhesi Bwrdd a Cholofnau  /  Trosi Tabl i Testun...

🧹 Ymdrech Glân: swap i ffwrdd Mannau Ychwanegol  /  Toriadau Adran  /  Pob Pennawd  /  Blychau Testun  /  hypergysylltiadau  / Am fwy o offer tynnu, ewch i'n Dileu Grŵp...

Mewnosodiadau Creadigol: mewnosod Mil o Wahanwyr  /  Blychau Gwirio  /  Botymau Radio  /  Cod QR  /  Cod Bar  /  Tabl Llinell Lletraws  /  Pennawd Hafaliad  /  Capsiwn Delwedd  /  Pennawd Tabl  /  Lluniau Lluosog  / Darganfod mwy yn y Mewnosod Grŵp...

🔍 Detholiadau Manwl: pinbwynt tudalennau penodol  /  tablau  /  siapiau  /  paragraffau pennawd  / Gwella llywio gyda mwy Dewiswch nodweddion...

Gwelliannau Seren: Llywiwch yn gyflym i unrhyw leoliad  /  auto-mewnosod testun ailadroddus  /  toglo'n ddi-dor rhwng ffenestri dogfennau  /  11 Offer Trosi...

???? Eisiau rhoi cynnig ar y nodweddion hyn? Mae Kutools ar gyfer Word yn cynnig a Treial am ddim 60-dydd, heb unrhyw gyfyngiadau! 🚀
 
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