Ed was telling us:
Ed nous racontait que :
> I can add text to a bookmark, but for some reason I can't delete it or
> overwrite with "". I'm using
[quoted text clipped - 3 lines]
> The bookmark deletes, but the text is still there! What am I doing
> wrong? Ed
What else are you doing in your code? What Word version?
All you need is:
ActiveDocument.Bookmarks("LeftOffHere").Range.Text = ""
this will delete the text in the bookmark, and the bookmark itself (once the
text is gone, what is there to bookmark? Nothing!).
You do not need to Select it first.
If it does not, tell us more about your particular situation because it
should.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Ed - 03 Aug 2005 21:55 GMT
Jean-Guy:
> What else are you doing in your code? What Word version?
>
[quoted text clipped - 6 lines]
> If it does not, tell us more about your particular situation because it
> should.
The book mark is to mark my place in a long document, so when I reopen the
doc I can go right to where I left off. The full macro (see below) checks
to see if the bookmark exists: if yes, it selects the bookmark to take me to
that place, then deletes it; if no, it creates the bookmark and puts
highlighted text in it. The bookmark deletes okay, but the text is still
there. I'm using Word 2000.
Ed
Sub LeftOffHere()
If ActiveDocument.Bookmarks.Exists _
("LeftOffHere") = True Then
ActiveDocument.Bookmarks("LeftOffHere").Select
ActiveDocument.Bookmarks("LeftOffHere").Range.Text = ""
ActiveDocument.Bookmarks("LeftOffHere").Delete
Else
ActiveDocument.Bookmarks.Add Name:="LeftOffHere"
ActiveDocument.Bookmarks("LeftOffHere").Range.HighlightColorIndex =
wdBrightGreen
ActiveDocument.Bookmarks("LeftOffHere").Range.Text = "~~**HERE**~~"
End If
End Sub
Helmut Weber - 04 Aug 2005 12:32 GMT
Hi Ed,
there are two kinds of bookmarks,
lets call them exclusive and inclusive.
Exclusive bookmarks look like !bookmark.text.
Inclusive bookmarks look like [bookmark.text].
Both behave strangely, in a way.
You can assign text to an exclusive bookmark,
ActiveDocument.Bookmarks("Mark1").Range.Text = "xxxx"
however,
msgbox ActiveDocument.Bookmarks("Mark1").Range.Text
returns nothing.
You can assign text to an inclusive bookmark, too,
ActiveDocument.Bookmarks("Mark2").Range.Text = "xxxxx"
however, after that, the bookmark doesn't exist anymore.
There are numerous examples here how to overcome that.
Need more help?
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Ed - 04 Aug 2005 14:41 GMT
Thanks for the info, Helmut. It appears I need to dig a bit deeper into
bookmarks. If I run into trouble, I'll yell!
Ed
> Hi Ed,
>
[quoted text clipped - 26 lines]
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"