AndresHernando
asked on
MS Word - Macro to delete last 3 pages of document
I have a 5-page MS Word document and want to put in a button or other mechanism that will allow the user to delete the last 3 pages of the document, which are instructions, leaving only the first two pages.
Thanks, --Andres
Thanks, --Andres
Not sure how to handle the editing restrictions, but a sequence like this will delete all but the first three pages of a document. Jump to page 4, back up a character, select through to end-of-document, and delete selection.
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="4"
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER