I have a procedure that updates the text in bookmarks as follows:
---------------------------------------------------------------------------------------------------------
Public Sub BookMark_Update(strBookMark As String, strText As String)
Dim oRange As Range

On Error GoTo BookMark_Update_Error

With ActiveDocument
Set oRange = .Bookmarks(strBookMark).Range
oRange.Text = strText
.Bookmarks.Add strBookMark, oRange
End With

BookMark_Update_Exit:

On Error GoTo 0
Exit Sub

BookMark_Update_Error:

[error routine]
Resume BookMark_Update_Exit

End Sub

------------------------------------------------------------------------------------------------------------
I use this to insert or update all the bookmarks in my document.
However, I am having a problem with one bookmark. After I insert the
text ok in this bookmark, and I try to refer to it again, I get the
error message that this bookmark does not exist. If I look for the
bookmarks in the document ( Insert->bookmarks), I can see the name of
this particular bookmark. If I look in the Visual Basic IDE, and look
at ThisDocuments.BookMarks, I cannot see this bookmark, but I see all
the other bookmarks. The only difference between this particular
bookmark and the other bookmarks in the document is that this
particular bookmark is very lengthy and contains tab values. I am
trying to refer to this particular bookmark to create table to contains
this bookmark's contents. I have this same procedure in other
documents. As a matter of fact, I just copied the whole code from
another document, that does work.

Re: Disappearing bookmarks by Jezebel

Jezebel
Fri Jun 30 21:17:10 CDT 2006

Can't see what's going wrong with your code; but an easier way to put
information into a document (and more reliable!) is to use document
properties and DocProperty fields.



<bluecraby2k@yahoo.com> wrote in message
news:1151708674.546914.244040@i40g2000cwc.googlegroups.com...
>I have a procedure that updates the text in bookmarks as follows:
> ---------------------------------------------------------------------------------------------------------
> Public Sub BookMark_Update(strBookMark As String, strText As String)
> Dim oRange As Range
>
> On Error GoTo BookMark_Update_Error
>
> With ActiveDocument
> Set oRange = .Bookmarks(strBookMark).Range
> oRange.Text = strText
> .Bookmarks.Add strBookMark, oRange
> End With
>
> BookMark_Update_Exit:
>
> On Error GoTo 0
> Exit Sub
>
> BookMark_Update_Error:
>
> [error routine]
> Resume BookMark_Update_Exit
>
> End Sub
>
> ------------------------------------------------------------------------------------------------------------
> I use this to insert or update all the bookmarks in my document.
> However, I am having a problem with one bookmark. After I insert the
> text ok in this bookmark, and I try to refer to it again, I get the
> error message that this bookmark does not exist. If I look for the
> bookmarks in the document ( Insert->bookmarks), I can see the name of
> this particular bookmark. If I look in the Visual Basic IDE, and look
> at ThisDocuments.BookMarks, I cannot see this bookmark, but I see all
> the other bookmarks. The only difference between this particular
> bookmark and the other bookmarks in the document is that this
> particular bookmark is very lengthy and contains tab values. I am
> trying to refer to this particular bookmark to create table to contains
> this bookmark's contents. I have this same procedure in other
> documents. As a matter of fact, I just copied the whole code from
> another document, that does work.
>