#1
|
|||
|
|||
Split paragraph into two different styles
I know how to do this manually by using the Style Seperator, but when recorded, I just get...
Code:
Sub Macro3() Selection.TypeParagraph Selection.InsertStyleSeparator End Sub Quote:
Example and macros attached with before and after. |
#2
|
||||
|
||||
For example:
Code:
Sub Demo() Application.ScreenUpdating = False Dim Rng As Range Set Rng = Selection.Range With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "Statement of Conditions" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found .Paragraphs.First.Style = wdStyleNormal .InsertAfter vbCr .Style = wdStyleHeading1 .Select Selection.InsertStyleSeparator .Collapse wdCollapseEnd .Find.Execute Loop End With Rng.Select Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you Paul. This works great.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I order the paragraph styles list? | Tunathedog | Word | 3 | 04-08-2016 05:37 AM |
Split pilcrow or paragraph symbol | nfotx | Word | 2 | 12-05-2014 02:48 PM |
Split a paragraph | bnyamin | Word VBA | 13 | 10-05-2014 08:18 PM |
Changing Paragraph Styles | mjawatney | Word | 6 | 04-20-2014 05:15 PM |
Multiple styles in same paragraph? | Cobb78 | Word | 1 | 05-20-2012 03:04 PM |