![]() |
#1
|
|||
|
|||
![]()
The code below works find to achieve the results below; however, it does not change just the selection. It changes other areas of the document which I don't want touched.
Each line in the before is a line with a paragraph mark at the end of each line. Before A2.3. Walk the dog A2.3.4.5. Feed the dog A2.3.4. Bath the dog A2.3. Walk the Cat A2.3.4.5. Feed the Cat After A2.3. Walk the dog A2.3.4.5. Feed the dog A2.3.4. Bath the dog A2.3. Walk the Cat A2.3.4.5. Feed the Cat After all the paragraph marks are inserted, each line with begin with A2. if that makes a difference. Code:
Sub FixReferences1() Dim oRng As Range Set oRng = ActiveDocument.Range With Selection With oRng.Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Bold = False .Text = "[ ^s^t](<[0-9A-Z]{2,})" .Replacement.Text = "^p\1" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End With End Sub |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
can't delete paragraph mark at end of document | kb | Word | 10 | 10-06-2017 02:32 PM |
![]() |
acerview | Mail Merge | 3 | 12-22-2015 07:44 PM |
Paragraph mark after horizontal line is way to the right. | DBlomgren | Word | 0 | 02-09-2014 11:42 PM |
![]() |
Caroline | Word | 2 | 02-22-2011 10:39 AM |
Adding a paragraph mark by style? | Jazz43 | Word | 0 | 02-14-2011 06:08 AM |