Macro to delet all section breaks bot not page breaks.

S

Smylie

I am having a hard time deleting all section breaks from certain word
documents at work and have come up with these two MACRO codes form a previous
discussion to delete them.

(Simple Version)

Sub ScratchMacro()
Dim oRgn As Range
Set oRgn = ActiveDocument.Range
With oRgn.Find
..Text = Chr(12)
While .Execute
oRgn.Delete
oRgn.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub


(More Complex Version)

Sub ScratchMacro()
Dim i As Long
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
..Text = Chr(12)
While .Execute
oRng.Select
If oRng.Information(wdWithInTable) Then
oRng.MoveEnd wdCharacter, 1
oRng.Collapse wdCollapseStart
With Selection
..MoveRight Unit:=wdCharacter, Count:=1
..SplitTable
..MoveLeft Unit:=wdCharacter, Count:=1
..MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
..Delete Unit:=wdCharacter, Count:=1
..Delete Unit:=wdCharacter, Count:=1
End With
Else
oRng.Delete
oRng.Collapse Direction:=wdCollapseEnd
End If
Wend
End With
End Sub



However, I need to find a way to do this without deleting the page breaks as
well. Any help with this would be great.

Note: the ^b replace with nothing method does not work for the specific
files I am working with for some reason. I think it is because these breaks
are not seen by this command because they are in a table.
 
S

Steve Schapel

Smylie,

The focus of this newsgroup is Macros in Access, the database program.

You will have a better chance of a good answer if you re-post to a
newsgroup concerned with the product you are using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top