How do I define a bookmark?

B

BobY

I am attempting to "automate" portions of a Word form (e.g., user enters
start and stop times, next box exhibits elapsed), and have forgotten how to
define cells by bookmarking.
 
J

Jay Freedman

BobY said:
I am attempting to "automate" portions of a Word form (e.g., user
enters start and stop times, next box exhibits elapsed), and have
forgotten how to define cells by bookmarking.

To set a bookmark on the selected text,

ActiveDocument.Bookmarks.Add Name:="myBk", Range:=Selection

or just

ActiveDocument.Bookmarks.Add Name:="myBk"

(the range is optional; if you omit it, the Selection is assumed).

To set a bookmark to a range that isn't selected, you can use a Range
object:


Dim oRg As Range
Set oRg = ActiveDocument.Sections(3).Range
ActiveDocument.Bookmarks.Add Name:="myBk", Range:=oRg


--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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