PDA

View Full Version : Remove Section Breaks except in tables



Fonsi
05-16-2018, 08:40 AM
Hello guys,


I´m using this code to remove all Sections Breaks from any document.


However, I would like to keep any section break included in tables.


Is there any way to add an exception to the code below so that the macro omit the section breaks in the tables?


Many thanks in advance!

________

Sub RemoveALLSectionBreak()
'
' RemoveALLSectionBreak Macro
'
'
Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

macropod
05-16-2018, 04:40 PM
You can't have a Section break in a table...

Kilroy
05-17-2018, 10:30 AM
Do you mean remove all unless the section break is the only thing between two tables?