Hello experts!
I have code by Jacob Hilderbrand:
All i want is to work code custom like:
Split document when 7th paragraph changes!
Document is like (might be different):
PAGE1
PAGE2
PAGE3
PAGE4
PAGE5
ETC
As a result from given example I want to see is 3 Word documents:
And save each document by trimmed text from 1st page 7th and 3rd paragraph of new document (of whole document each page's 3rd paragraph is different)
Save for 1st document with Text1 would be: It's "Paragraph7_Paragraph3.docx"
I have code by Jacob Hilderbrand:
Code:
Option Explicit
Sub AllSectionsToSubDoc()
Dim x As Long
Dim Sections As Long
Dim Doc As Document
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set Doc = ActiveDocument
Sections = Doc.Sections.Count
For x = Sections - 1 To 1 Step -1
Doc.Sections(x).Range.Copy
Documents.Add
ActiveDocument.Range.Paste
ActiveDocument.SaveAs (Doc.Path & "\" & x & ".doc")
ActiveDocument.Close False
Next x
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
All i want is to work code custom like:
Split document when 7th paragraph changes!
Document is like (might be different):
PAGE1
Text
Text
Text
Text
Text
Text
Text1
Text
Text
PAGE2
Text
Text
Text
Text
Text
Text
Text1
Text
Text
PAGE3
Text
Text
Text
Text
Text
Text
Text2
Text
Text
PAGE4
Text
Text
Text
Text
Text
Text
Text3
Text
Text
PAGE5
Text
Text
Text
Text
Text
Text
Text3
Text
Text
ETC
As a result from given example I want to see is 3 Word documents:
- 1st Word document all pages when Text1 is in paragraph 7;
- 2nd Word document all pages when Text2 is in paragraph 7;
- 3rd Word document all pages when Text3 is in paragraph 7;
- ETC...
And save each document by trimmed text from 1st page 7th and 3rd paragraph of new document (of whole document each page's 3rd paragraph is different)
Save for 1st document with Text1 would be: It's "Paragraph7_Paragraph3.docx"