Bỏ qua nội dung chính

Làm thế nào để chia tài liệu thành nhiều tài liệu trong word?

Nếu bạn có một tài liệu word khổng lồ mà bạn cần chia thành nhiều tài liệu, hãy dành vài phút để đọc hướng dẫn này. Hướng dẫn này sẽ chỉ cho bạn hai phương pháp để chia một tài liệu thành nhiều tài liệu.


Tách tài liệu Word bằng dấu phân cách được chỉ định với VBA

Thay vì chia tài liệu thành nhiều tài liệu theo cách thủ công, phương pháp này sẽ giới thiệu một VBA để chia tài liệu Word theo dấu phân cách được chỉ định trong Word. Vui lòng làm như sau:

1. nhấn Alt + F11 các phím với nhau để mở cửa sổ Microsoft Visual Basic for Application;

2. Nhấp chuột Chèn > Mô-đun, và sau đó dán mã VBA bên dưới vào cửa sổ Mô-đun mở mới.

VBA: Chia tài liệu Word thành nhiều tài liệu bằng dấu phân cách

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. Sau đó nhấn vào chạy hoặc nhấn phím F5 để áp dụng VBA.

4. Trong tài liệu Microsoft Word hiện ra, vui lòng nhấp vào nút Có để tiếp tục.

Lưu ý:
(1) Đảm bảo thêm dấu phân cách của bạn giống như "///" trong bài kiểm tra phụ đối với tài liệu giữa mỗi phần văn bản mà bạn muốn tách biệt. Ngoài ra, bạn có thể thay đổi "///" cho bất kỳ dấu phân cách nào để đáp ứng nhu cầu của bạn.
(2) Bạn có thể thay đổi các tài liệu "Ghi chú" trong bài kiểm tra phụ để phù hợp với nhu cầu của bạn.
(3) Và các tài liệu tách sẽ được lưu vào cùng một nơi với tệp gốc.
(4) Bạn không cần thêm dấu phân cách vào cuối tệp gốc, nếu bạn làm vậy, sẽ có một tài liệu trống sau khi tách.

Chia tài liệu Word theo từng trang bằng VBA

Đây là một VBA khác để giúp bạn nhanh chóng chia một tài liệu Word thành nhiều trang trong Word. Vui lòng làm như sau:

1. nhấn Alt + F11 các phím với nhau để mở cửa sổ Microsoft Visual Basic for Application;

2. Nhấp chuột Chèn > Mô-đun, và sau đó dán mã VBA bên dưới vào cửa sổ Mô-đun mở mới.

VBA: Chia tài liệu thành nhiều tài liệu theo trang trong 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. Sau đó nhấn vào chạy nút hoặc bấm F5 để áp dụng VBA.

Lưu ý: Các tài liệu tách sẽ được lưu vào cùng một nơi với tệp gốc.


Tách tài liệu Word theo tiêu đề / trang / ngắt phần / ngắt trang bằng cách sử dụng Kutools cho Word

Nếu bạn đã cài đặt Kutools cho Word, bạn có thể áp dụng chẻ có chức năng dễ dàng chia một tài liệu thành nhiều tài liệu theo trang, tiêu đề, ngắt phần hoặc ngắt trang khi bạn cần trong Word ..

Kutools cho Word là phần bổ trợ Word tối ưu giúp hợp lý hóa công việc của bạn và nâng cao kỹ năng xử lý tài liệu của bạn. Dùng thử MIỄN PHÍ cho 60 ngày! Lấy nó ngay!

1.Nhấp chuột Kutools Plus > chẻ để cho phép chẻ tính năng này.

2. Trong hộp thoại Tách mở trên màn hình, bạn có thể làm như sau:

(1) Chọn cách tách từ Chia theo danh sách thả xuống.
Tính năng này hỗ trợ 6 cách tách: tiêu đề 1, ngắt trang, ngắt phần, trang, mỗi n trang và phạm vi trang tùy chỉnh như hình minh họa bên dưới:

(2) Nhấp vào Xem nút  để cụ thể hóa thư mục đích mà bạn sẽ lưu các tài liệu được chia thành;

(3) Nhập từ khóa làm tiền tố của tên tài liệu mới trong Tiền tố tài liệu cái hộp.

Lời khuyên:
(1) Nếu bạn chỉ định chia tài liệu hiện tại theo Mỗi n trang, bạn cần chỉ định số trong Mỗi n trang cái hộp;

(2) Nếu bạn chỉ định tách tài liệu hiện tại theo phạm vi trang tùy chỉnh, bạn cần nhập các phạm vi trang tùy chỉnh này được phân tách bằng dấu phẩy trong Trang , ví dụ: nhập 1, 3-5, 12 vào hộp.

3. Nhấn vào Ok nút để bắt đầu tách.

Sau đó, tài liệu hiện tại được chia theo cách tách được chỉ định và các tài liệu mới sẽ được lưu hàng loạt vào thư mục đích.

Duyệt theo tab & chỉnh sửa nhiều tài liệu Word như Firefox, Chrome, Internet Explore 10!

Có thể bạn đã quen với việc xem nhiều trang web trong Firefox / Chrome / IE và chuyển đổi giữa chúng bằng cách nhấp vào các tab tương ứng một cách dễ dàng. Ở đây, Tab Office hỗ trợ xử lý tương tự, cho phép bạn duyệt nhiều tài liệu Word trong một cửa sổ Word và dễ dàng chuyển đổi giữa chúng bằng cách nhấp vào tab của chúng. Nhấp để dùng thử miễn phí đầy đủ các tính năng!
Duyệt nhiều tài liệu từ trong một cửa sổ dưới dạng Firefox


Các bài báo tương đối:


Công cụ năng suất văn phòng tốt nhất

Kutools cho Word - Nâng cao trải nghiệm sử dụng từ của bạn với Over 100 Các tính năng đáng chú ý!

🤖 Trợ lý AI của Kutools: Biến đổi bài viết của bạn bằng AI - Tạo nội dung  /  Viết lại văn bản  /  Tóm tắt tài liệu  /  Hỏi thông tin dựa trên tài liệu, tất cả đều có trong Word

📘 Làm chủ tài liệu: Chia trang  /  Hợp nhất tài liệu  /  Lựa chọn xuất khẩu ở nhiều định dạng khác nhau (PDF/TXT/DOC/HTML...)  /  Chuyển đổi hàng loạt sang PDF  /  Xuất trang dưới dạng hình ảnh  /  In nhiều tập tin cùng một lúchữu ích. Cảm ơn !

Chỉnh sửa nội dung: Tìm và thay thế hàng loạt trên nhiều tệp  /  Thay đổi kích thước tất cả hình ảnh  /  Hoán đổi hàng và cột của bảng  /  Chuyển bảng thành văn bảnhữu ích. Cảm ơn !

🧹 Dễ dàng làm sạch: Quét đi Không gian bổ sung  /  Phần ngắt  /  Tất cả các tiêu đề  /  Hộp văn bản  /  Các siêu liên kết  / Để biết thêm các công cụ xóa, hãy truy cập Xóa nhómhữu ích. Cảm ơn !

Phụ trang quảng cáo: Chèn Ngàn dấu phân cách  /  Hộp kiểm tra  /  Nút radio  /  Mã QR  /  Mã vạch  /  Bảng đường chéo  /  Chú thích phương trình  /  Hình ảnh Caption  /  Bảng chú thích  /  Nhiều Hình Ảnh  / Khám phá thêm trong Chèn nhómhữu ích. Cảm ơn !

???? Lựa chọn chính xác: Xác định trang cụ thể  /  bảng  /  hình dạng  /  đoạn văn tiêu đề  / Tăng cường điều hướng với chi tiết Chọn tính nănghữu ích. Cảm ơn !

Cải tiến sao: Điều hướng nhanh chóng đến bất kỳ vị trí nào  /  tự động chèn văn bản lặp đi lặp lại  /  chuyển đổi liền mạch giữa các cửa sổ tài liệu  /  11 công cụ chuyển đổihữu ích. Cảm ơn !

👉 Bạn muốn thử những tính năng này? Kutools cho Word cung cấp một 60 ngày dùng thử miễn phí, không có giới hạn! 🚀
 
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