Ana içeriğe atla

Bir Word belgesini her 5 veya n sayfada bir ayrı dosyalara nasıl bölerim?

Yüzlerce sayfa içeren büyük bir Word belgeniz varsa ve şimdi, bu belgeyi her 10 veya n sayfada bir ayrı dosyalara bölmek istiyorsunuz. Sayfaları tek tek kopyalayıp yapıştırmadan bu işi çözmenin hızlı ve kolay bir yolu var mı?

VBA kodu ile her 10 veya n sayfada bir Word belgesini ayrı dosyalara bölün

Harika bir özellikle bir Word belgesini her 10 veya n sayfada bir ayrı dosyalara bölün


VBA kodu ile her 10 veya n sayfada bir Word belgesini ayrı dosyalara bölün

Büyük bir belgeyi her 10 veya n sayfaya göre ayrı dosyalara bölmek için aşağıdaki VBA kodu size bir iyilik yapabilir, lütfen şu şekilde yapın:

1. Basılı tutun ALT + F11 tuşlarını açmak için Uygulamalar için Microsoft Visual Basic pencere.

2. Ve sonra tıklayın Ekle > modül, aşağıdaki kodu kopyalayıp açılan boş modüle yapıştırın:

VBA kodu: Bir belgeyi her 10 veya n sayfada bir ayrı dosyalara bölün:

Sub DocumentSplitter()
    Dim xDoc As Document, xNewDoc As Document
    Dim xSplit As String, xCount As Long, xLast As Long
    Dim xRngSplit As Range, xDocName As String, xFileExt As String
    Dim xRegEx As RegExp
    Dim xPageCount As Integer
    Dim xShell As Object, xFolder As Object, xFolderItem As Object
    Dim xFilePath As String
    On Error Resume Next
    Set xDoc = Application.ActiveDocument
    Set xShell = CreateObject("Shell.Application")
    Set xFolder = xShell.BrowseforFolder(0, "Select a Folder:", 0, 0)
    If TypeName(xFolder) = "Nothing" Then Exit Sub
    Set xFolderItem = xFolder.Self
    xFilePath = xFolderItem.Path & "\"
    Application.ScreenUpdating = False
    Set xNewDoc = Documents.Add(Visible:=False)
    xDoc.Content.WholeStory
    xDoc.Content.Copy
    xNewDoc.Content.PasteAndFormat wdFormatOriginalFormatting
    With xNewDoc
        xPageCount = .ActiveWindow.Panes(1).Pages.Count
L1:     xSplit = InputBox("The document contains " & xPageCount & " pages." & _
                 vbCrLf & vbCrLf & " Please enter the page count you want to split:", "Kutools for Word", xSplit)
        If Len(Trim(xSplit)) = 0 Then Exit Sub
        Set xRegEx = New RegExp
        With xRegEx
            .MultiLine = False
            .Global = True
            .IgnoreCase = True
            .Pattern = "[^0-9]"
        End With
        If xRegEx.Test(xSplit) = True Then
            MsgBox "Please enter the page number:", vbInformation, "Kutools for Word"
            Exit Sub
        End If
        If VBA.Int(xSplit) >= xPageCount Then
            MsgBox "The number is greater than the document number." & vbCrLf & "Please re-enter", vbInformation, "Kutools for Word"
            GoTo L1
        End If
        xDocName = xDoc. Name
        xFileExt = VBA.Right(xDocName, Len(xDocName) - InStrRev(xDocName, ".") + 1)
        xDocName = Left(xDocName, InStrRev(xDocName, ".") - 1) & "_"
        xFilePath = xFilePath & xDocName
        For xCount = 0 To Int(xPageCount / xSplit)
            xPageCount = .ActiveWindow.Panes(1).Pages.Count
            If xPageCount > xSplit Then
                xLast = xSplit
            Else
                xLast = xPageCount
            End If
            Set xRngSplit = .GoTo(What:=wdGoToPage, Name:=xLast)
            Set xRngSplit = xRngSplit.GoTo(What:=wdGoToBookmark, Name:="\page")
            xRngSplit.Start = .Range.Start
            xRngSplit.Cut
            Documents.Add
            Selection.Paste
            ActiveDocument.SaveAs FileName:=xFilePath & xCount + 1 & xFileExt, AddToRecentFiles:=False
            ActiveWindow.Close
        Next xCount
        Set xRngSplit = Nothing
        xNewDoc.Close wdDoNotSaveChanges
        Set xNewDoc = Nothing
    End With
    Application.ScreenUpdating = True
End Sub

3. Yukarıdaki kodu yapıştırdıktan sonra hala Uygulamalar için Microsoft Visual Basic pencere, lütfen tıklayın Tools > Referanslarve dışarı çıkmış Referanslar-Proje iletişim kutusu, işaretleyin Microsoft VBScript Normal İfadeler 5.5 seçeneği Mevcut Referanslar liste kutusu, ekran görüntüsüne bakın:

4. Sonra tıklayın OK düğmesine ve ardından F5 bu kodu çalıştırmak için anahtar ve bir Klasöre Göz At iletişim kutusu görüntülenir, lütfen bölünmüş dosyaları yerleştirmek istediğiniz bir klasör seçin, ekran görüntüsüne bakın:

5. Sonra tıklayın OK düğmesi ve bölmek istediğiniz sayfa sayısı numarasını girmenizi hatırlatmak için başka bir istem kutusu açılır, ekran görüntüsüne bakın:

6. Ve sonra tıklayın OK düğmesi, aktif Word belgesi her 10 sayfada bir ayrı dosyalara bölünmüştür, sonuçları görmek için belirtilen klasöre gidebilirsiniz:


Harika bir özellikle bir Word belgesini her 10 veya n sayfada bir ayrı dosyalara bölün

Kutools for Word güçlü bir özellik içerir- Bölünmüş işlevi, bu yardımcı programla, büyük bir Word belgesini Başlık1, sayfa sonu, bölüm sonu ve sayfaya göre birden çok ayrı dosyaya hızlı bir şekilde bölebilirsiniz.

İpuçları:Bunu uygulamak için Bölünmüş özelliği, öncelikle indirmelisiniz Kutools for Wordve ardından özelliği hızlı ve kolay bir şekilde uygulayın.

Kurduktan sonra Kutools for Wordlütfen şunu yapın:

1. tıklayın Kutools Artı > Bölünmüş, ekran görüntüsüne bakın:

2. Açılan iletişim kutusunda, lütfen aşağıdaki işlemleri istediğiniz gibi ayarlayın, ekran görüntüsüne bakın:

3. Ayarları tamamladıktan sonra lütfen tıklayın OKve tüm belge, her sayfaya göre birden çok dosyaya bölünecek, ekran görüntüsüne bakın:

Kutools for Word'ü indirmek ve şimdi ücretsiz deneme için tıklayın!

En İyi Ofis Üretkenlik Araçları

Kutools for Word - Over ile Kelime Deneyiminizi Yükseltin 100 Dikkat Çekici Özellikler!

🤖 Kutools Yapay Zeka Asistanı: Yazılarınızı AI ile dönüştürün - İçerik Oluştur  /  Metni Yeniden Yaz  /  Belgeleri Özetleyin  /  Bilgi İçin Arayın Belgeye dayalı, hepsi Word'de

📘 Belge Ustalığı: Sayfaları Böl  /  Belgeleri Birleştir  /  Seçimi Çeşitli Formatlarda Dışa Aktar (PDF/TXT/DOC/HTML...)  /  PDF'ye Toplu Dönüştürme  /  Sayfaları Görüntü Olarak Dışa Aktar  /  Aynı Anda Birden Çok Dosyayı Yazdırma...

İçerik Düzenleme: Toplu Bul ve Değiştir Birden Çok Dosyada  /  Tüm Resimleri Yeniden Boyutlandır  /  Tablo Satırlarını ve Sütunlarını Yer Değiştirme  /  Tabloyu Metne Dönüştür...

🧹 Zahmetsiz Temizlik: Uzaklaşın Ekstra Alanlar  /  Bölüm Sonları  /  Tüm Başlıklar  /  Metin kutuları  /  Köprüler  / Daha fazla sökme aleti için sayfamıza gidin Grubu Kaldır...

Yaratıcı Ekler: Ekle Bin Ayırıcı  /  Onay Kutuları  /  Radyo Düğmeleri  /  QR Code  /  Barkod  /  Çapraz Çizgi Tablosu  /  Denklem Başlığı  /  Görüntü Başlık  /  Tablo başlığı  /  Çoklu Resimler  / Daha fazlasını şurada keşfedin: Grup Ekle...

🔍 Hassas Seçimler: Nokta tespiti belirli sayfalar  /  tablolar  /  şekiller  /  başlık paragrafları  / Gezinmeyi şununla geliştirin: Daha Özellikleri seçin...

Yıldız Geliştirmeleri: Herhangi bir konuma hızla gidin  /  tekrarlanan metni otomatik olarak ekle  /  belge pencereleri arasında sorunsuzca geçiş yapın  /  11 Dönüşüm Aracı...

👉 Bu özellikleri denemek ister misiniz? Kutools for Word şunları sunar: 60 günlük ücretsiz deneme, hiçbir sınırlama olmaksızın! ????
 
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
good things. i used it to split with 1 page 1 word document, it was successful except that each document (after split), it has 2 pages in total although 2nd page is always blank. 
This comment was minimized by the moderator on the site
this code gives compile error which shows user define type is not define
This comment was minimized by the moderator on the site
For me, the VBA creates a single document that is a copy of the original and that's it.
This comment was minimized by the moderator on the site
The VBscript code made Word crash. I was trying to split a 32Mb Word file with many pages but it seems Word can't handle it through VBscript.
Thanks anyway
This comment was minimized by the moderator on the site
Hello, Studia,
The VBA code may crash when there is a large document, it is not stable, so I recommend you use our Kutools for Word tool, it has updated, and support to solve this task, you can download it and free trial 30 day.
Please try, thank you!
This comment was minimized by the moderator on the site
VBA Script: Split a document into separate files every 10 or n pages not worked
This comment was minimized by the moderator on the site
Hello, Sergey,
The above code works well in my Word document, which Word version do you use?
And which step went wrong in your operation?
This comment was minimized by the moderator on the site
i have been trying to split a word file of 166 pages and it gives 166 files each with 166 pages?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations