Delete Page 71?

  • Thread starter Thread starter Leonard M. Wapner
  • Start date Start date
L

Leonard M. Wapner

Is there a way to delete a specific page, or pages, without going to each
individually and selecting all?

Thanks -

L
 
Word is not a page layout program and so a 'page' is a very nebulous entity
made up of several different 'layers' including the drawing layer, text
later and headers/footers. Deleting pages from documents which use various
of these elements can be unpredictable - however, it is easy enough to use a
macro to delete a particular page. The code below will do that, but don't be
too disappointed if it screws up your formatting.

Sub PageDelete()
sNumber = InputBox("Delete from which page", "Delete Pages", 1)
sRange = InputBox("Delete how many pages", "Delete Pages", 1)
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=sNumber
For a = 1 To sRange
ActiveDocument.Bookmarks("\page").Range.Delete
Next a
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>><
 
I really admire the simplicity of this method of deleting a page (something
I'm trying to do as a general purpose vba routine right now), but the method
below seems to have a small flaw; that is, when it's used to delete the last
page of a document, and there's a page break just before that last page, the
page break is not deleted.

In other circumstances, the page break is deleted.

Just an fyi to anyone using this.

Chip
 
Back
Top