![]() |
|
#1
|
|||
|
|||
|
way Split a paragraph over 2000 word and create a
new paragraph |
|
#2
|
||||
|
||||
|
Press the enter key?
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Since this is a VBA forum, perhaps the OP needs a VBA solution:
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey If Selection.Paragraphs(1).Range.Words.Count > 2000 Then Selection.InsertParagraph End If End Sub |
|
#4
|
|||
|
|||
|
More to the point, "split" how, where?
|
|
#5
|
||||
|
||||
|
Undoubtedly, but it would need a lot more information in order to provide that. Is the paragraph 2000 words or does it need to be split at 2000 words?
What constitutes a 'word' and where in relation to that 2000th word should the text (I hesitate to call it a paragraph) be split? At the end of the 2000th word? At the end of the current sentence? At the beginning of the current sentence? Does the text even have sentences? If the former, the task is impossible. You cannot produce a grammatically correct text by splitting a larger text using VBA. A paragraph is more than simply an arbitrarily broken piece of text. Hence my earlier reply.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#6
|
|||
|
|||
|
Split at the 100th word? At the 1000th word?
|
|
#7
|
|||
|
|||
|
Thanks all friends' answers
That was not my intention by asking that question To make myself clear I need a vba code to classify each paragraph not more than 2000 words, and the beginning of each paragraph starts with the word resume or continuance. Regardless of grammatically wrong sentences. Again I thank you for your attention Best regards |
|
#8
|
|||
|
|||
|
Classify such paragraphs how\what? Paragraphs start with sentences. Sentences start, typically with a capitalized word "Resume", "Continuance."
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oPar As Paragraph
For Each oPar In ActiveDocument.Paragraphs
If oPar.Range.Words.Count < 2000 Then
Select Case Trim(oPar.Range.Words(1))
Case "Resume", "Continuance"
MsgBox "Classify me how\hat?"
End Select
End If
Next
lbl_Exit:
Exit Sub
End Sub
|
|
#9
|
|||
|
|||
|
Quote:
IF a paragraph is < 2000 words; AND ONLY if that paragraph starts with "resume" or "continuance" go to the end of that paragraph and add a paragraph mark. If the paragraph is <2000 words, and does NOT start with "resume" or "continuance", do nothing. If the paragraph starts with "Resume" or "Continuance", do nothing. If the paragraph is 2000 words, or greater, do nothing. Remember THAT is precise what you said to do. Is this correct? |
|
#10
|
|||
|
|||
|
for example i have ten paragraph with different words into
for example first paragraph for me formation feature or property enumerate 1500 words , this paragraph is correct for me. but , for example second paragraph for me formation feature or property enumerate 3000 words , this paragraph is incorrect for me ... and i need one paragraph with 2000 words and then create new paragraph with 1000 word . for example Third paragraph for me formation feature or property enumerate 5000 words , this paragraph is incorrect for me ... and i need two paragraph with 2000 words and then create new paragraph with 1000 word i need only , into paragraph for me max 2000 words then create new paragraph in the new line and... when create new paragraph , insert for firsten word "Continuance" with vba code i insert two files and describe with samples for you.. name for firsten file is "befor " and name for second file is "after" this file create 7252 words ... |
|
#11
|
|||
|
|||
|
I am sorry, but those documents are so terrible, so bad, with such poor structure, I can not look at them. I hope someone else can help you.
I have no idea why you want such a "result". but the "after" document is so bad, I want nothing to do with it. |
|
#12
|
|||
|
|||
|
i need this code vba for separate text for CONTENT ANALYSIS in social science
|
|
#13
|
||||
|
||||
|
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, RngPara As Range, RngTemp As Range
With ActiveDocument
j = .Paragraphs.Count
For i = 1 To j
Set RngPara = .Paragraphs(i).Range
Set RngTemp = .Paragraphs(i).Range
With RngPara
While .Paragraphs.Last.Range.ComputeStatistics(wdStatisticWords) > 2000
Set RngTemp = .Paragraphs.Last.Range
With RngTemp
.End = .Start
.MoveEnd wdWord, 2000
While .ComputeStatistics(wdStatisticWords) <> 2000
.MoveEnd wdWord, 2000 - .ComputeStatistics(wdStatisticWords)
Wend
.InsertAfter vbCr & "Continuance ... "
j = j + 1
End With
Wend
End With
Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#14
|
|||
|
|||
|
thanks thanks thanks , for answer
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Split Slide | Akip Tsaqif | PowerPoint | 0 | 09-07-2014 10:50 PM |
| How to split .pst file | annabrown8812 | Outlook | 1 | 10-03-2013 04:27 AM |
Narrow Paragraph to Wide Paragraph HELP
|
icloudy | Word | 1 | 12-09-2012 03:49 PM |
| Split a task | fridos | Project | 2 | 05-30-2011 11:19 AM |