delete the last paragragh or section using VBA

V

VBA Novice

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.
 
V

VBA Novice

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.
 
T

Tony Jollans

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top