![]() |
|
#1
|
|||
|
|||
![]() wow, thanks for the fast response time. This is almost exactly what I, i tried it out, and it worked almost perfectly. What happened was i ran it on the entire document, which is several hundred pages long, and it compressed it into one large paragraph. This is an improvement over what i had before, but not the paragraphs that are supposed to exist in the book are gone. Is there any way that I can have word only do that command to paragraphs that start with a lowercase letter? this would work for 99% of the time because formal paragraphs start with an uppercase letter, and there broken paragraphs do not unless the word that appears first in a proper noun or something capitalized. That tiny margin for error really doesnt make any difference to me. If you know some way that i can make that happen, I would be so happy! Thanks Again! Andrew |
#2
|
||||
|
||||
![]()
I would say the quickest, and probably most accurate, way would be to run through the document and add your [**] symbols yourself, then just Find and Replace the paragraph markers. - I know that this isn't the ideal solution, but having done the same thing that you are aiming to do, and having done it a million and one times, I just found it the most accurate!
It IS possible to write some VBA code to do what you want - BUT, it WON'T be anywhere near as accurate. For example, you asked about sorting it by paragraph - the problem is, your document has a paragraph marker at the end of every line, oops! How about adapting your search string and turning it into a VBA code string: Code:
Sub Find_and_Replace_Loop() ' Code String Written by Bird - 2009 ' This macro will find and replace ' a) all full stops, question marks and exclamation marks followed by double paragraph markers ' b) 2 paragraph markers together - this is repeated in case there are 3 or four together ' c) all single paragraph markers, into spaces ' d) finally putting paragraph markers back. Selection.Find.ClearFormatting With Selection.Find .Text = ".^p^p" .Replacement.Text = ".**" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "?^p^p" .Replacement.Text = "?**" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "!^p^p" .Replacement.Text = "!**" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "^p^p" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "^p^p" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "^p^p" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "^p" .Replacement.Text = " " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With With Selection.Find .Text = "**" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Loop End Sub Have a go at it and see if you can adapt it to your needs. To add the VBA code:
To run it - (2003) Tools > Macro > Macros (or Alt+F8) (2007) View > Macros > View Macros (or Alt+F8) Have fun with the code - play around with it to suit your needs. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Niko | Excel | 5 | 04-23-2009 12:05 AM |
Table of Contents Formatting | Rick5150 | Word | 1 | 03-16-2009 11:10 AM |
Re Formatting Columns? | erikjen | Word | 0 | 02-16-2009 12:25 AM |
![]() |
Peter B. | Word | 5 | 05-10-2006 08:13 AM |
Different page number formatting. | gerrie | Word | 0 | 04-15-2006 07:31 PM |