Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete bookmark via VBA 2

Status
Not open for further replies.

ninash

Technical User
Jul 6, 2001
163
GB
Hi All,

Is there a way of deleting a line that contains a bookmark using vba???
I will need to find the bookmark first then delete the whole line.

Is there anyone can help

Thanks
Tony
 
try something like...

ActiveDocument.Bookmarks("delme").Range.Paragraphs(1).Range.Delete
 
Tony,

Try the following:

Code:
ActiveDocument.Bookmarks("LineToDelete").Select
Selection.HomeKey Unit:=wdLine, Extend:=wdMove
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete

Hope this helps.

M. Smith
 
Thanks to you both

Both methods worked even though I went with justins answer.

However silly fool that I am this has caused another problem.

In removing the line I now need to add a line at a set point in order to keep the formatting correct.

After another bookmark would be perfect, that way I would always know it is correctly alined.

thanks again in advance of your replies

Tony Hooper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top