Consulting

Results 1 to 3 of 3

Thread: Remove Section Breaks except in tables

  1. #1
    VBAX Regular
    Joined
    May 2018
    Posts
    6
    Location

    Remove Section Breaks except in tables

    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

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    You can't have a Section break in a table...
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Tutor
    Joined
    Jul 2016
    Posts
    266
    Location
    Do you mean remove all unless the section break is the only thing between two tables?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •