Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-05-2020, 05:10 AM
robrob robrob is offline spliting paragraphs after n words Windows 10 spliting paragraphs after n words Office 2016
Novice
spliting paragraphs after n words
 
Join Date: Mar 2020
Posts: 3
robrob is on a distinguished road
Default spliting paragraphs after n words

i have a document with many paragraphs. all formated like:



T: ...
P: ...
T: ...



fist i delete all paragraphs with T: at the beginning with a macro that delete text between two words:



------------------------------------

Sub DeleteTextBetweenTwoWords()
Dim strFirstWord As String
Dim strLastWord As String
Dim objDoc As Document
Dim objWord As Object



Set objDoc = ActiveDocument
strFirstWord = "T:"
strLastWord = "P:"

With Selection
.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = strFirstWord & "*" & strLastWord
.Replacement.Text = strLastWord
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End With

Set objDoc = Nothing
Set objWord = Nothing
End Sub
------------------------------------------


the result is that i only get the paragraphs with P: at the beginning.

how can i split now the remaining paragraphs after, for example, 50 words?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find (highlight) two and more words in a list of 75k single words in Word 2010 Usora Word 8 05-29-2018 03:34 AM
spliting paragraphs after n words Capitalize one to two words if they are the only words on a line jrhlavac Word VBA 1 10-08-2015 08:19 PM
spliting paragraphs after n words How to mark underlined words in a sentence as A, B, C, D (beneath the words) thudangky Word 13 12-12-2013 02:22 AM
spliting paragraphs after n words Spliting column with text and numbers mjosic Excel 3 04-04-2012 05:56 AM
Why Words doesn’t show the style of the selected words automatically???? Jamal NUMAN Word 0 04-14-2011 03:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft