View Single Post
 
Old 02-04-2018, 01:18 PM
KvT Zdam KvT Zdam is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2018
Posts: 2
KvT Zdam is on a distinguished road
Default

I'll post miniature version of the Excel code and make Word template to give a better insight. I think I mixed-up the code. I tried it again and seems to do better .

Code:
Sub DelBm()

Dim StrBM As String
       StrBM = "J_03"
Dim Rng As Range
 
With ActiveDocument
    Set Rng = Selection.GoTo(What:=wdGoToBookmark, Name:=StrBM)
    Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
    Rng.Delete
End With
End Sub
I misinterpreted what the "\page" bookmark really dit. I thought it was limited to one page.
That does explain a few of the problems i had:

"Current page, including the break at the end of the page, if any. The current page contains the insertion point. If the current selection contains more than one page, the "\Page" bookmark is the first page of the selection. Note that if the insertion point or selection is in the last page of the document, the "\Page" bookmark does not include the final paragraph mark"

I can't test the full document jet, but whit the older versions of the excel/word I have now this code left behind ==========section-end(continuous)========= and the chapters lose the sequential numbering:

4. Interne 8
5.1 Overzicht 9
5.2 Dagelijks 10
5.5 Halfjaar 27
5.6

This is after updating the full table of contents. But if I re-assign a view chapter headings it updates the rest as wel.
Reply With Quote