Loncat ke daftar isi utama

Bagaimana cara membagi dokumen menjadi beberapa dokumen di Word?

Jika Anda memiliki dokumen kata yang sangat besar yang perlu Anda bagi menjadi beberapa dokumen, luangkan beberapa menit untuk membaca tutorial ini. Tutorial ini akan menunjukkan dua metode untuk membagi dokumen menjadi beberapa dokumen.


Pisahkan dokumen Word dengan pembatas tertentu dengan VBA

Alih-alih membagi dokumen menjadi beberapa dokumen secara manual, metode ini akan memperkenalkan VBA untuk membagi dokumen Word dengan pembatas yang ditentukan di Word. Harap lakukan sebagai berikut:

1. tekan Alt + F11 bersama-sama untuk membuka jendela Microsoft Visual Basic for Application;

2. Klik Menyisipkan > Modul, lalu tempelkan kode VBA di bawah ini ke jendela Modul pembuka yang baru.

VBA: Pisahkan Dokumen Word menjadi Beberapa Dokumen dengan Pembatas

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. Lalu klik Run atau tekan tombol F5 untuk menerapkan VBA.

4. Dalam dokumen Microsoft Word yang muncul, klik tombol Yes untuk melanjutkan.

Catatan:
(1) Pastikan untuk menambahkan pembatas Anda sama seperti "///" di sub tes ke dokumen antara setiap bagian teks yang ingin Anda pisahkan. Juga, Anda bisa berubah "///" ke pembatas apa pun untuk memenuhi kebutuhan Anda.
(2) Anda dapat mengubah dokumen "Catatan" di sub Uji sesuai dengan kebutuhan Anda.
(3) Dan dokumen pemisahan akan disimpan ke tempat yang sama dengan file aslinya.
(4) Anda tidak perlu menambahkan pembatas di akhir file asli, jika Anda melakukannya, akan ada dokumen kosong setelah pemisahan.

Pisahkan dokumen Word demi halaman dengan VBA

Berikut adalah VBA lain untuk membantu Anda dengan cepat membagi satu dokumen Word menjadi beberapa halaman di Word. Harap lakukan sebagai berikut:

1. tekan Alt + F11 bersama-sama untuk membuka jendela Microsoft Visual Basic for Application;

2. Klik Menyisipkan > Modul, lalu tempelkan kode VBA di bawah ini ke jendela Modul pembuka yang baru.

VBA: Pisahkan Dokumen menjadi Beberapa Dokumen berdasarkan Halaman di 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. Lalu klik Run tombol atau tekan F5 kunci untuk menerapkan VBA.

Catatan: Dokumen yang dipisahkan akan disimpan ke tempat yang sama dengan file aslinya.


Pisahkan dokumen Word dengan heading / page / section break / page break dengan menggunakan Kutools for Word

Jika Anda menginstal Kutools for Word, Anda dapat menerapkannya Split berfungsi untuk dengan mudah membagi satu dokumen menjadi beberapa dokumen berdasarkan halaman, judul, hentian bagian, atau hentian halaman seperti yang Anda butuhkan di Word ..

Kutools for Word adalah add-in Word terbaik yang menyederhanakan pekerjaan Anda dan meningkatkan keterampilan pemrosesan dokumen Anda. Cobalah GRATIS untuk 60 hari! Dapatkan itu sekarang!

1.Klik Kutools Ditambah > Split untuk mengaktifkan Split fitur.

2. Dalam dialog Pisah pembuka di layar, Anda dapat melakukan hal berikut:

(1) Pilih cara pemisahan dari Pisahkan dengan daftar drop-down
Fitur ini mendukung 6 cara pemisahan: heading 1, page break, section break, halaman, setiap n halaman, dan rentang halaman kustom seperti gambar di bawah ini yang ditampilkan:

(2) Klik Browse tombol  untuk menentukan folder tujuan tempat Anda akan menyimpan dokumen yang terpisah;

(3) Ketik kata kunci sebagai awalan nama dokumen baru di Awalan Dokumen kotak.

Tip:
(1) Jika Anda menentukan pembagian dokumen saat ini dengan Setiap n halaman, Anda perlu menentukan nomor di Setiap n halaman kotak;

(2) Jika Anda menentukan untuk membagi dokumen saat ini dengan rentang halaman kustom, Anda perlu memasukkan rentang halaman kustom ini dipisahkan dengan koma di Halaman kotak, misalnya, ketik 1, 3-5, 12 di kotak.

3. klik Ok tombol untuk mulai membelah.

Kemudian dokumen saat ini dipisahkan dengan cara pemisahan yang ditentukan, dan dokumen baru akan disimpan ke folder tujuan secara massal.

Menjelajah dengan tab & mengedit beberapa dokumen Word sebagai Firefox, Chrome, Internet Explore 10!

Anda mungkin tidak asing lagi untuk melihat beberapa halaman web di Firefox / Chrome / IE, dan beralih di antaranya dengan mengklik tab yang sesuai dengan mudah. Di sini, Office Tab mendukung pemrosesan serupa, yang memungkinkan Anda menelusuri beberapa dokumen Word dalam satu jendela Word, dan dengan mudah beralih di antara mereka dengan mengklik tabnya. Klik untuk uji coba gratis fitur lengkap!
Jelajahi beberapa dokumen kata dalam satu jendela sebagai Firefox


Artikel relatif:


Alat Produktivitas Kantor Terbaik

Kutools for Word - Tingkatkan Pengalaman Kata Anda dengan Over 100 Fitur Luar Biasa!

๐Ÿค– Asisten AI Kutools: Ubah tulisan Anda dengan AI - Hasilkan Konten  /  Menulis Ulang Teks  /  Meringkas Dokumen  /  Menanyakan Informasi berdasarkan Dokumen, semuanya dalam Word

๐Ÿ“˜ Penguasaan Dokumen: Halaman Terpisah  /  Gabungkan Dokumen  /  Ekspor Pilihan dalam Berbagai Format (PDF/TXT/DOC/HTML...)  /  Konversi Batch ke PDF  /  Ekspor Halaman sebagai Gambar  /  Cetak Banyak File sekaligus...

โœ Pengeditan Isi: Temukan dan Ganti Batch di Banyak File  /  Ubah Ukuran Semua Gambar  /  Ubah Urutan Baris dan Kolom Tabel  /  Ubah Tabel menjadi Teks...

รฐลธยงยน Bersih dengan Mudah: Menyapu Spasi Ekstra  /  Bagian Istirahat  /  Semua Header  /  Teks box  /  Hyperlink  / Untuk alat penghapus lainnya, kunjungi kami Hapus Grup...

โž• Sisipan Kreatif: Memasukkan Seribu Pemisah  /  Kotak Centang  /  Tombol Radio  /  Kode QR  /  barcode  /  Tabel Garis Diagonal  /  Keterangan Persamaan  /  Keterangan gambar  /  Keterangan Tabel  /  Banyak Gambar  / Temukan lebih lanjut di Sisipkan Grup...

๐Ÿ” Pilihan Presisi: Tepat halaman tertentu  /  tabel  /  bentuk  /  paragraf judul  / Tingkatkan navigasi dengan lebih Pilih fitur...

โญ Peningkatan Bintang: Navigasi dengan cepat ke lokasi mana pun  /  menyisipkan teks berulang secara otomatis  /  beralih antar jendela dokumen dengan mulus  /  11 Alat Konversi...

๐Ÿ‘‰ Ingin mencoba fitur-fitur tersebut? Kutools for Word menawarkan a Uji coba gratis 60-hari, tanpa batasan! ๐Ÿš€
 
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