Bookmarks

D

Doc60

I have created bookmarks in a table. However when a user enters new
information in the field the bookmark is erased.

I have tried using the following code:

Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks("value1").Range
BMRange.Text = "0.1"
ActiveDocument.Bookmarks.Add "Value1", BMRange

However, as you can see I have had to enter the BMRange.text as "0.1". In
order for this to work. I don't want to have enter a value in the code. I
want the user to beable to enter a value in the table so that the value can
also be changed. Is here a way to do this. Please be specific with the code
that is necessary.

Thank you
 
D

Doc60

The code I wrote is the same. But this requires the value to be but in the
code and want to have the user put the value in the table without removing
the bookmark.
 
D

Doc60

I had already used the reference you mentioned. That is where the code from.
Please help further.
 
D

David Sisson

 
I want the user to be able to enter a value in the table
so that the value can also be changed.  

If your table in unprotected, then there is no way to prevent someone
from deleting bookmarks.

Here are a few othe ways to approach it.

You could add formfields in the table. Then the user can change the
field as required and you'd still have tha ability to change the
contents via code without losing the bookmark.

You could change the data via table coordinates.
ActiveDocument.Tables(1).Cell(2, 3).Range.Text = "My Text"

You could use a inputbox, and paste results via table coordinates.

You could create a userform to collect all relevant data and paste
using table coordinates.
 
S

Stefan Blom

Sorry, I misunderstood your original post. :-(

See David's reply instead.

--
Stefan Blom
Microsoft Word MVP


in message
 
J

Julian

One way you could do this would be to create additional rows or columns for
your table and set their height/width to zero - the user could not then
click in cells that contain the bookmark entries... (though they could of
course TAB into them :(.. but then you could use a selectionchange event to
check row/colum number and immediately move the selection out again, check
that the bookmark didn't get erased - but if it did, recreate it.

HTH
 

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