Hi Peter,
working on pages is not a good idea. Pages as well
as lines may change without notice. If you type just
one character at the beginning of your document, many
lines and pages may be affected. Paragraph(6), however,
would stay paragraph(6) as well as Shape(4). There could
be side effects, you aren't aware of. Without
extensive handling of exceptions, you may get
into trouble. The following code accesses page 500,
or the last page in case the number of pages is less
than 500. It deletes the accessed page, if that page
is not the last of the document. In case it is,
it deletes the accessed page, nevertheless,
if the end of document isn't an empty paragraph. If
the last page consists of only an empty paragraph,
that page is deleted ...
And probably some complications more. Just try it.
---
Sub delpage(iPgn As Integer)
'With ActiveDocument.BuiltInDocumentProperties
' If iPgn > .Item("number of pages") Then
' MsgBox "no such page"
' Exit Sub
' End If
'End With
With Selection
.ExtendMode = False
.GoTo what:=wdGoToPage, _
which:=wdGoToAbsolute, _
Count:=iPgn
Selection.Bookmarks("\page").Range.Delete
End With
End Sub
Sub Test222()
delpage 500
End Sub
And a checkbox to start a command,
isn't a good idea either, sorry.