Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2018, 06:29 AM
staicumihai staicumihai is offline Macro to delete pages in Word 2007 Windows 7 32bit Macro to delete pages in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to delete pages in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default Macro to delete pages in Word 2007

Hi guys,



I need a macro to delete all the pages from the current page to the end of a Word 2007 document.

Do you have any ideas ?

Thank you.
Reply With Quote
  #2  
Old 10-25-2018, 06:53 AM
gmayor's Avatar
gmayor gmayor is offline Macro to delete pages in Word 2007 Windows 10 Macro to delete pages in Word 2007 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

How about


Code:
Sub DeleteToEnd()
Dim oRng As Range
    Set oRng = ActiveDocument.Bookmarks("\page").Range
    oRng.Collapse 0    'end of page. If you want to delete from the start of the page change the 0 to 1
    oRng.End = ActiveDocument.Range.End
    oRng.Delete
    Set oRng = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 10-30-2018, 04:42 AM
staicumihai staicumihai is offline Macro to delete pages in Word 2007 Windows 7 32bit Macro to delete pages in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to delete pages in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default

Thank you Gmayor
Reply With Quote
  #4  
Old 11-06-2018, 04:43 AM
staicumihai staicumihai is offline Macro to delete pages in Word 2007 Windows 7 32bit Macro to delete pages in Word 2007 Office 2010 32bit
Advanced Beginner
Macro to delete pages in Word 2007
 
Join Date: Dec 2015
Posts: 33
staicumihai is on a distinguished road
Default Add delete key

Hi Gmayor!

Do you know how can I add the delete key to the macro you gave me ?

Thanks a lot!
Reply With Quote
  #5  
Old 11-07-2018, 01:14 AM
Guessed's Avatar
Guessed Guessed is offline Macro to delete pages in Word 2007 Windows 10 Macro to delete pages in Word 2007 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Your question doesn't make sense.

If you are asking how to run this macro with a keyboard command try two separate commands
Ctrl-Shift-End to select to end of document
Del to delete selection
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete pages in Word 2007 How to delete blank hidden pages in Word 2016 Mac? michaellanfield Word 13 01-03-2019 08:05 AM
Macro to delete pages in Word 2007 Need Word Macro to Delete Text rsrasc Word VBA 4 04-18-2018 11:32 PM
Word 2007 Full Screen 2 Pages NIDALAP Word 2 08-07-2017 03:39 AM
How To Show Number of Pages in Word 2007 CGM3 Word 2 07-21-2013 08:17 PM
I have a Word 2007 document that only show 13 pages xeonix Word 0 07-06-2009 08:38 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft