Completely Deleting Bookmarks...

O

Outatym

I have code to find certain bookmarks then delete their contents (The
bookmark called "PhysicalDamage" below consists of 2 pages, while the
bookmark "SUMMARY_PD" is one row in a table on the last page). The code will
run fine and delete the "SUMMARY_PD" bookmark and row, but will leave blank
space where the "Physical Damage" bookmark used to be. I need this to be
deleted as well.

These bookmarks are pages within a document and are separated by manual page
breaks...if that helps out the process any.

Any idea on how to remove this? Below is part of the code...

If txt_PD_Premium.Text = "" Then
ActiveDocument.Bookmarks("PhysicalDamage").Range.Delete
ActiveDocument.Bookmarks("SUMMARY_PD").Range.Rows.Delete
Else
If txt_PD_Premium.Text = "" Then
I_PDPremium = 0
Else
I_PDPremium = CInt(txt_PD_Premium.Text)
End If
With ActiveDocument
.Bookmarks("SUMMARY_PDAMT").Range _
.InsertBefore "$" + txt_PD_Premium
End With
End If

Thanks for your help!!!
 
G

Gordon Bentley-Mix

I suspect that the problem has to do with what's 'inside' the
"PhysicalDamage" bookmark. Check to make sure that the bookmark completely
encompasses everything you want to delete.

Otherwise I see nothing in your code that would leave a blank space when the
bookmark is deleted; .Range.Delete should take out everything inside the
limits of the bookmark - at least it does in every document where I use it.
--
Cheers!
Gordon
The Kiwi Koder

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 

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