writing to a bookmark inside a textframe - possible?

G

Gina

Hi.

I have a bookmark which is inside a textframe .... I am trying to write
something to it and I get an error that it can't find the bookmark - is it
possible at all??

it works fine with a 'normal' bookmark

(accessing it via vba from access 2000)


Thanks,
Gina
 
J

Jezebel

Shouldn't be a problem, unless there's something odd about how you are
getting the bookmark reference. However, a better way to put information
into a document if you're using automation, is to use
CustomDocumentProperties and DocProperty fields. Then your bookmarks
problem, whatever it is, will go away. (Code is simpler, too.)
 
G

Gina

Hi Jezebel.

thanks for your answer.
well, I thought so as well ...that it shouldn't be a problem.
but as soon as I reference a bookmark which is inside a textframe I get an
error saying that word can't find the specified bookmark.

Unfortunately I am not familiar with that vba stuff in word and in general
so I would be grateful for an example piece of code as to how accessing the
things (CustomDocumentProperties and DocProperty fields.) you suggested.

Gina
 
J

Jezebel

To do this with document properties --

1. Define a custom document property for each item of data you need to deal
with, using File > Properties > Custom. Insert a dummy value in each case.
If you define the properties in a template they are inherited by docouments
created from the template.

2. In place of the bookmarks in your document, insert DocProperty fields.

3. In your code, instead of setting the value of the bookmark, set the value
of the property --

ActiveDocument.CustomDocumentProperties("Property Name").Value = ....

4. When you've set all the property values, update the fields.
 
G

Gina

Thanks Jezebel, for your explanation.

Doesn't sound more difficult to define than the bookmark stuff.

gonna try this!!!

Gina
 

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