Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Next Page Section Break

Status
Not open for further replies.

MrSR

Instructor
Jan 23, 2002
39
US
I have a macro that runs to clean up converted word perfect documents. I go in and replace all section breaks (^b) with nothing. This works fine. However in one particular document right before a table there is a next page section break that is not being deleted. I have tried several things and nothing works. I want that next page section break deleted. Any suggestions. I know how to manipulate. For instance i change it from next page to continuous but I can not select it and delete it. Thanks in advance.
 
Code:
Sub RemoveSectionBreaks()
Dim var
    Selection.HomeKey Unit:=wdStory
For var = 0 To ActiveDocument.Sections.Count
    Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext, Count:=1, Name:=""
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        Selection.Delete Unit:=wdCharacter, Count:=1
Next
End Sub

This should remove sections breaks. PLEASE note however, that, unlike WP, all header and footer objects are totally linked to the Section. Removing Section breaks can have very dire effects on headers and footers. If you have any, please make a copy of your file before running this. There will likely be consequences. Any problems, post back.

Gerry
 
thank you very much. i modified it a little bit and that works just fine. i really appreciate your time.
 
I have seen this before on converted documents. The only way that I have been able to delete the break is to make a few returns before it, a few returns after and then to select the big block of white space in between the paragraphs you want to keep. Ideally the break should be in the middle of the large white space. When you delete all those empty rows, you will delete the break too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top