Hi,
According to this post
https://www.extendoffice.com/documents/word/5415-split-word-document-every-x-pages.html#a1
Please I want the same idea but with word count
So I want to split a word document every 14000 words in the same folder.
Thanks
According to this post
https://www.extendoffice.com/documents/word/5415-split-word-document-every-x-pages.html#a1
Please I want the same idea but with word count
So I want to split a word document every 14000 words in the same folder.
Thanks
0
7 months ago
·
#8584 Hi there,
We will certainly take your suggestion into consideration for inclusion in future versions of the feature! Thank you for your valuable input!
And, I've generated the below VBA code using Kutools AI Aide and tested it successfully. Please feel free to give it a try:
NOTE: Ensure you back up your document before executing this VBA script to safeguard against potential issues or to revert any changes if necessary.
Let me know if you encounter any issues or if there's anything else I can assist you with.
Amanda
We will certainly take your suggestion into consideration for inclusion in future versions of the feature! Thank you for your valuable input!
And, I've generated the below VBA code using Kutools AI Aide and tested it successfully. Please feel free to give it a try:
NOTE: Ensure you back up your document before executing this VBA script to safeguard against potential issues or to revert any changes if necessary.
Sub SplitDocumentEvery14000Words()
Dim originalDoc As Document
Set originalDoc = ActiveDocument
Dim wordCount As Long
wordCount = 0
Dim docIndex As Integer
docIndex = 1
Dim newDoc As Document
Set newDoc = Documents.Add
Dim originalDocPath As String
originalDocPath = originalDoc.Path
Dim i As Long
For i = 1 To originalDoc.Words.Count
wordCount = wordCount + 1
newDoc.Content.InsertAfter originalDoc.Words(i).Text
' Split and save every 14000 words
If wordCount >= 14000 Then
' Reset word count
wordCount = 0
' Save the document
newDoc.SaveAs2 FileName:=originalDocPath & "\SplitDoc_" & docIndex & ".docx"
' Prepare for next document
docIndex = docIndex + 1
Set newDoc = Documents.Add
End If
Next i
' Save the last document if it has content
If newDoc.Content.Words.Count > 1 Then
newDoc.SaveAs2 FileName:=originalDocPath & "\SplitDoc_" & docIndex & ".docx"
Else
newDoc.Close False
End If
MsgBox "Documents have been split successfully."
End Sub
Let me know if you encounter any issues or if there's anything else I can assist you with.
Amanda
- Page :
- 1
There are no replies made for this post yet.
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »