![]() |
|
#1
|
|||
|
|||
|
I am using Word 2010. I inserted bookmarks in a document. I made the bookmarks visible by by checking the appropriate box in the Word set-up.
The bookmarks look like this: I I want the book marks to reflect the names I am giving them. For example if I name a bookmark "alpha," I would like to see "alpha" in the document next to the text I am bookmarking. How can I do this? |
|
#2
|
||||
|
||||
|
The short answer is no, but you could use a macro to add hidden text at the bookmarked location. How useful that wopuld be in practice, I can't say but
Code:
Sub LabelBookmarks()
Dim oBM As Bookmark
Dim oRng As Range
For Each oBM In ActiveDocument.Bookmarks
Set oRng = oBM.Range
oRng.Collapse 1
oRng.Text = oBM.Name
oRng.Font.Hidden = True
oRng.End = oBM.End + 1
oRng.Collapse 0
Next oBM
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
lbl_Exit:
Set oBM = Nothing
Set oRng = Nothing
Exit Sub
End Sub
Rather more useful would be http://www.gmayor.com/BookmarkandVariableEditor.htm which will list the bookmarks and their contents and provide easy access to them.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
It would be useful because I could see the names of the bookmarks in the document.
|
|
#4
|
|||
|
|||
|
I was looking for my Normal file template and could not find it. I revealed all hidden the files. It used to be in a folder called Templates, under User/Roaming...or something like that. I believe that's where my macro were stored.
|
|
#5
|
||||
|
||||
|
I would add the bookmark name by using the commenting function. IMO, that is much more user friendly. The code to do that is as follows.
Code:
Sub LabelBookmarks()
Dim oBM As Bookmark
For Each oBM In ActiveDocument.Bookmarks
ActiveDocument.Comments.Add oBM.Range, "Bookmark: " & oBM.Name
Next oBM
lbl_Exit:
Set oBM = Nothing
Exit Sub
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#6
|
||||
|
||||
|
Quote:
%appdata%\Microsoft\Templates to the address window of Windows Explorer and you will be taken to the folder that contains the default template - which for Word 2007 on is normal.dotm. Note that this folder is normally hidden.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#7
|
||||
|
||||
|
Quote:
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vba to go to next bookmark | megatronixs | Word VBA | 2 | 06-08-2014 09:53 PM |
VBA to insert Bookmark
|
rockwellsba | Word VBA | 2 | 05-31-2011 01:07 AM |
| Bookmark Classification | DrDoom | Word | 0 | 06-29-2010 07:08 AM |
| Bookmark to another document | spqr | Word | 3 | 06-26-2009 04:51 AM |