P
Peter Faulhaber
Hi All,
I have a document with multiple sections. The first page is a TOC and the
last one is the INDEX.
The user can add sections in the document. VBA code is working fine. The VBA
code is searching for the end of section and add a section break
BUT when a user want to add a section after INDEX, the section is added
after the TOC?
The VBA code is
Sub Sectie_Einde()
' Opzoek naar het einde van de sectie
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.CorrectHangulEndings = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakNextPage
End Sub
I have a document with multiple sections. The first page is a TOC and the
last one is the INDEX.
The user can add sections in the document. VBA code is working fine. The VBA
code is searching for the end of section and add a section break
BUT when a user want to add a section after INDEX, the section is added
after the TOC?
The VBA code is
Sub Sectie_Einde()
' Opzoek naar het einde van de sectie
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.CorrectHangulEndings = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakNextPage
End Sub