Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Delete Section Break in Macro (Word 2000/XP)

    What is the code to delete a section break in a macro? I only have 2 sections in a form and the document eventually is saved as a TXT file and I have to delete the section break prior to that to eliminate the extra line it puts in when saved as a TXT file.

    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete Section Break in Macro (Word 2000/XP)

    This is rather simplistic code:

    ' Make sure you're at start of document
    Selection.HomeKey Unit:=wdStory
    ' Go to next section
    Selection.GoTo wdGoToSection
    ' Move to left of section break
    Selection.MoveLeft
    ' Delete it
    Selection.Delete

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Delete Section Break in Macro (Word 2000/XP)

    I normally use a search and replace to find ^b and replace it with either nothing or ^p.

    In some files, people don't use a paragraph mark in front of the section break so deleting the break and not replacing it with a return can result in a merging of two paragraphs.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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