Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

Delete to end-of-file?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Charnes - 24 Oct 2005 19:37 GMT
Is there a VBA command for "delete to the end of this document"?  
Thanks.
Anne Troy - 24 Oct 2005 20:33 GMT
I recorded this, Rick:
   Selection.EndKey Unit:=wdStory, Extend:=wdExtend
   Selection.Delete Unit:=wdCharacter, Count:=1

There's probably a more eloquent way of doing it.
************
Anne Troy
www.OfficeArticles.com

> Is there a VBA command for "delete to the end of this document"?
> Thanks.
Tony Jollans - 24 Oct 2005 20:35 GMT
Not, AFAIK, an explicit single command but this should do it:

Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete

--
Enjoy,
Tony

> Is there a VBA command for "delete to the end of this document"?
> Thanks.
Doug Robbins - Word MVP - 24 Oct 2005 20:38 GMT
Dim myrange as Range
Set myrange=Selection.Range
myrange.End = ActiveDocument.Range.End
myrange.Delete

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Is there a VBA command for "delete to the end of this document"?
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.