Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

How do I delete a range (pages) in a document using VBA.

$
0
0

I am trying to code a macro that will select all the text/pages from page 2 to the end of the document, and delete it, leaving the cursor in the home position on pg 2.  I have this code which will delete only page 2.  

I am stuck, please help!

'Selection.GoTo wdGoToPage, wdGoToAbsolute, 2
'ActiveDocument.Bookmarks("\page").Range.Delete

I works perfectly, but only clears the 2nd page. I need it to be able to clear all pages from page 2 to the end of the document.

Thanks, Sean


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>