|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Replacing paragraph formatting before column break also changes the next paragraph after the break
I have a large document with 2 columns per page. I want to change the formatting of the last paragraph in each column. When I use Replace to change ^p^n to ^p^n with new formatting for the replacement, it also changes the formatting of the first paragraph in the next column. Is there any way I can make it change only the paragraph before the break?
|
#2
|
||||
|
||||
You would need to use a macro for that, as it appears the column break is attached to the paragraph following it. Such a macro might be coded as:
Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "^p^n" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found .Paragraphs.First.Style = "My Style" If .End = ActiveDocument.Range.End Then Exit Sub .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
easy way to do it
I've been thinking about this for about a year, and just now the answer came to me.
I don't use the @ character in my document. So I Replaced: ^p^n with @^p^n. Now the last paragraph in each column contains @. Now I Replaced @ with @ with the desired formatting. Then I verified the formatting. Then I Replaced @ with nothing, thus removing it. Now the last paragraph in each column is properly formatted, without affecting the next paragraph. Why did it take me so long to think of such a simple method? I fall back on my standard answer these days: "I'm 74 years old". |
#4
|
||||
|
||||
Sometimes it just takes a bit of 'thinking outside the box'. At 74, you should have a head start on that
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
inserting wordwrap table causes paragraph break in text | sodiumkpump | Word Tables | 1 | 08-05-2015 06:36 PM |
Insert paragraph break before images | jsoule | Word VBA | 3 | 02-25-2015 07:53 AM |
How can I temporarily break a 3 column format in order to type a single column paragraph | William P | Word | 1 | 01-04-2015 06:40 PM |
Records paragraph break | ervilhaman | Mail Merge | 14 | 04-09-2013 02:55 PM |
URGENT: Mail 'Merge To New Doc' restarts paragraph numbering at each Section break | JamesF | Mail Merge | 0 | 07-28-2011 07:26 AM |