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 / March 2006

Tip: Looking for answers? Try searching our database.

delete the last paragragh or section using VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VBA Novice - 08 Mar 2006 22:07 GMT
Let's say I pulled some data into word and decided to delete it.  What VBA
code I can use to delete the data I just pulled, not knowing exactly the
paragrah or section #?

Thank you for your input.
Tony Jollans - 08 Mar 2006 22:22 GMT
Rather vague question but I would consider using Undo.

--
Enjoy,
Tony

> Let's say I pulled some data into word and decided to delete it.  What VBA
> code I can use to delete the data I just pulled, not knowing exactly the
> paragrah or section #?
>
> Thank you for your input.
VBA Novice - 09 Mar 2006 21:37 GMT
Let me clarify my question.  

I have a control button which pulls in some data off Excel using
content.insert.after in coding.  I need to know what code I can use to clear
the data I just pulled in, something like activedocuments.content.delete.  My
problem is that I do not want to delete everything on the page.  

Thanks.

> Rather vague question but I would consider using Undo.
>
[quoted text clipped - 7 lines]
> >
> > Thank you for your input.
Tony Jollans - 10 Mar 2006 12:58 GMT
I'm not a lot wiser after that I'm afraid. If you want to delete it you've
got to know where it is - precisely. My guess is that it starts at what was
content.end before the insert and runs to what is now the end of the
document (content.end again) so you'll need to save the start position and
delete the appropriate range, perhaps ....

   Activedocument.range(whateveroldendwas, whatevernewendis).delete

But you haven't said why you can't use Undo - what do you do between
inserting it and wanting to delete it?

--
Enjoy,
Tony

> Let me clarify my question.
>
[quoted text clipped - 16 lines]
> > >
> > > Thank you for your input.
 
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.