Setting Title property from bookmarked text

J

jls

I would like to set the value of the Title property from
the contents of a bookmark. How can I do this?

I have managed to use "docProperties(wdPropertyTitle)" to
set the Title property to a literal, but I can't figure
out how to derive the value of the Title property from a
bookmark that is defined within the document.
 
D

Dave Lett

Hi jls,

You can use the following:

With ActiveDocument
.BuiltInDocumentProperties("Title") = .Bookmarks("myBkmk").Range.Text
End With

HTH,
Dave
 
J

Jay Freedman

jls said:
I would like to set the value of the Title property from
the contents of a bookmark. How can I do this?

I have managed to use "docProperties(wdPropertyTitle)" to
set the Title property to a literal, but I can't figure
out how to derive the value of the Title property from a
bookmark that is defined within the document.

Try this (assuming the bookmark named bkmkTitle exists):

With ActiveDocument
.BuiltInDocumentProperties(wdPropertyTitle).Value = _
.Bookmarks("bkmkTitle").Range.Text
End With
 

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