![]() |
#1
|
|||
|
|||
![]()
The following macro replaces single blank paragraphs in a selection with a tab starting the following paragraph, but it tabs any second successive blank line returns rather than removing them, and does not tab the first paragraph selected. Also, it brings up the "would you like to continue searching the document" dialogue, which is unnecessary. I tried toying with the macro, but I don't know what I'm doing, so it didn't work.
I appreciate your help. Code:
Sub ParasBlankToTabSelection() ' ' Replaces blank paragraphs with a tab starting following paragraph in selected text. ' ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^13^13" .Replacement.Text = "^p^t" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub |
#2
|
||||
|
||||
![]()
Perhaps:
Code:
Sub ParasBlankToTabSelection() Application.ScreenUpdating = False With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^13{2,}" .Replacement.Text = "^p^t" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Perhaps, indeed, Paul; as always you are the master in these matters. May the sun shine brightly on your day.
|
![]() |
Tags |
find/replace macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
IF Statement Adjustment | shawn.low@cox.net | Mail Merge | 0 | 09-23-2019 10:08 AM |
![]() |
zbiku25 | Project | 3 | 02-28-2017 09:03 AM |
![]() |
PokerBob | Excel | 8 | 03-18-2015 02:57 PM |
![]() |
TheMax | OneNote | 1 | 01-23-2015 04:33 PM |
Macro Needed to bold specific lines and Macro to turn into CSV | anewteacher | Word VBA | 1 | 05-28-2014 03:59 PM |