Bookmark hot key

  • Thread starter Thread starter Dan Irwin
  • Start date Start date
D

Dan Irwin

hi,

Is there a way that i can make a hot key which will make a bookmark
out of a highlighted word automaticly, without having to go through
the bookmark menu?

thanks for the help,
dan
 
Write a macro and associate it with a key combination. You'll still need
some user input to get the bookmark name.
 
Hi Dan

You can put this macro in normal.dot or a global add-in template, and
assign it to a keyboard shortcut, a toolbar button, or a right-click
menu. It will use the word at the cursor both for the location of the
bookmark and for its name.

Sub BookmarkThisWord()
ActiveDocument.Bookmarks.Add _
Name:=Trim(Selection.Words(1).Text), _
Range:=Selection.Words(1)
End Sub

Be aware, though, that any document can contain no more than one
bookmark with any name, so if you run the macro on a second location
of the same word, the bookmark in the first location will disappear.

Also, if you want the bookmark name to be different than the marked
word, you can't use this macro -- you have to use the regular dialog
to assign the name. There's no way to "rename" an existing bookmark;
you have to delete it and make a new one with the new name.
 
Thanks for the help,

One question. Why when i use this if i use it with a food such as
Bad_dog, the book mark will olny come out as Bad, leaving _dog out?

thanks,

dan
 
That would be the line:

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
And if your selection *begins* with an underscore, the bookmark will be
shown in the list of bookmarks only if you check the 'hidden bookmarks'
checkbox.
 

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

Back
Top