![]() |
#1
|
|||
|
|||
![]()
Hi all :-)
I'm a new one in Word developing and would like to ask for a small support. I do have template, when running a mailemerge from one excel column, whether do have a complex concatenate formula ( out of 10 columns behind). What I need, as after mail emerge I do have a lot of empty rows. Is there any change or possibility to have some sort of VBA code that will automatically remove all empty rows between this sentences, example and will keep only 1 empty row? "You are in amid of this agreement." "You are in the end of this agreement. " I have found the following code, but this will delete all empty rows in document. Is it possible to update it for above condition? Quote:
Andy |
#2
|
|||
|
|||
![]()
Hi! The folowing code will replace all 3 and more paragraph signs with two ones in the selected range:
Code:
Sub Deleemptyparagraphs() selection.Find.ClearFormatting selection.Find.Replacement.ClearFormatting With selection.Find .text = Chr(13) & "{3;}" .Replacement.text = "^p^p" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .MatchAllWordForms = False .MatchSoundsLike = False End With selection.Find.Execute Replace:=wdReplaceAll End Sub |
#3
|
|||
|
|||
![]()
This might not be the exact answer you are looking for, but using "empty" paragraphs for spacing is a poor formatting choice.
Remove the empty paragraphs: Code:
Sub ScratchMacro() 'A basic Word Macro coded by Gregory K. Maxey Dim oRng As Range Dim oPar As Paragraph Set oRng = ActiveDocument.Range With oRng.Find .Text = Chr(13) & "{2,}" .Replacement.Text = "^p" .MatchWildcards = True .Execute Replace:=wdReplaceAll End With lbl_Exit: Exit Sub End Sub Determine the style that you have applied to your text and modify its Space Before property to 12 pts or whatever you want, or modify its line spacing property to double. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
syl3786 | Word VBA | 4 | 03-27-2023 05:01 PM |
![]() |
WordMonkey1 | Mail Merge | 2 | 10-28-2020 12:25 AM |
Let bookmark check if there are empty bookmarks before and place sentence there? | RevoMedia | Word VBA | 7 | 01-21-2020 08:04 AM |
![]() |
aaghd72 | Word VBA | 8 | 02-18-2019 11:22 AM |
![]() |
Yarikh | Mail Merge | 4 | 09-23-2018 12:17 AM |