I need to remove the section 2, merging the document in only one section with a VBA code.
Code:
Sub Rem_Sec()
Dim oSec As Section, x As Integer
For x = 2 To ActiveDocument.Sections.Count
ActiveDocument.Sections(x).Headers(wdHeaderFooterPrimary).LinkToPrevious = True
Next x
With ActiveDocument.Range.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
End Sub
But this code causes a blank header in the final document, the first section loose format.
There's any solution to this?
Thanks.