Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: Bookmarks (XP)

  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Bookmarks (XP)

    Is there a way to see the name of the bookmark field in the document in addition to the gray brackets that show up when you choose view/bookmarks?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    Not really, since the brackets could be marking more than 1 bookmark.

    A macro could be written to list al lthe books in the current selection, but you would need to distinguish those that covered the whole bookmark from those that lived entirely, or partially within the selection.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Bookmarks (XP)

    So that means that if I make a document with bookmarks and I forget exactly where they are, I cannot see them, without putting up the list of bookmaks sorted by place and then going through it one by one. That is DUMB!

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmarks (XP)

    Not an ideal solution, but you could write a WindowSelectionChange routine in a class module that calls something like this...

    Public Sub ShowBookMarks()
    If Selection.Bookmarks.Count <> 1 Then Exit Sub
    MsgBox Selection.Bookmarks(1).Name
    End Sub

    You wouldn't want it enabled permanently, but I just tested it and it seems to work fine. I have left it in one of my Global templates with the call to ShowBookMarks commented out.
    It wouldn't be too hard to add a toolbar menu item to enable and disable the functionality so you wouldn't have to go into VBA to turn it on and off.

    If you don't know how to write an application event module then look at <!profile=HansV>HansV<!/profile>'s excellent star <post#=203498>post 203498</post#>

    StuartR

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    There are several solutions, but I'm not sure if this is what you're looking for.

    1. Prime Consulting makes an add-in that gives you a dropdown bookmark toolbar. I haven't checked recently, but I got it here.

    2. Gary Frieder wrote a macro that enabled you to right click on a bookmark & get it's name. Unfortunately, with the search facility down, I don't know where it is, so I'll repost it here:<pre>Public Sub BookmarkName()
    '
    ' from Gary Frieder on Woody's Lounge
    ' modified with error handler & multiple bookmark handler by Charles Kenyon
    ' message changed slightly by Phil Rabichow
    '
    ' Add to context menus
    Dim iBookCount As Integer 'number of bookmarks
    Dim iCount As Integer 'counter for loop
    Dim sName As String 'holds bookmark name in loop
    '
    On Error GoTo NoBookMark
    iBookCount = Selection.Bookmarks.Count
    If iBookCount > 1 Then
    For iCount = 1 To iBookCount
    sName = Selection.Bookmarks(iCount).Name
    MsgBox Prompt:="There are " & iBookCount & " bookmarks!" _
    & vbCrLf & "Bookmark " & iCount & " is " _
    & sName, _
    Buttons:=vbInformation, TITLE:="Multiple Bookmarks Names"
    Next iCount
    Exit Sub
    End If
    MsgBox Prompt:=" " _
    & Selection.Bookmarks(1).Name & "", _
    Buttons:=vbInformation, TITLE:="Bookmark Name"
    Exit Sub
    NoBookMark:
    MsgBox Prompt:="No bookmark here.", _
    TITLE:="Sorry!", Buttons:=vbExclamation
    End Sub</pre>

    3. If you wanted to, you could creat a screen tip for each bookmark.
    a. Select a bookmark.
    b. Press Ctrl+K to insert a hyperlink.
    c. In the text to show, it will show what is selected. Click Bookmarks.
    d. Select the bookmark name & click OK.
    e. Type the bookmark name in the screen tip.

    You would probably want to redefine the hyperlink character style as to omit the underline & blue color.
    Cheers,

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    That doesn't do the deed as it only shows the first bookmark in the selection, there could be several.

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmarks (XP)

    Howard, I had realised that, but I was too lazy to do anything about it! How about this...

    Public Sub ShowBookMarks()
    If Selection.Bookmarks.Count > 0 Then
    Dim txtBmkNames as String
    Dim bmkNext as Bookmark

    For Each bmkNext in Selection.Bookmarks
    txtBmkNames = txtBmkNames & bmkNext.Name & vbCrLf
    Next bmkNext
    MsgBox txtBmkNames

    End If
    End Sub

    Completely untested, just typed into the lounge edit box...

    StuartR

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    Not only is the following untested, I am not yet awake and have not had anything to eat so I am not yet functioning:
    <pre>Public Sub ShowBookMarks()
    Dim txtBmkNames as String
    Dim bmkNext as Bookmark

    txtBmkNames = ""
    For Each bmkNext in Selection.Bookmarks
    txtBmkNames = txtBmkNames & bmkNext.Name & vbCrLf
    Next bmkNext
    if Len(txtBmkNames) = 0 then
    Msgbox "There ain't no bookmark critters in the selection"
    else
    MsgBox "Hey, dude, here's a list of the bookmark critters in the selection:" & _
    vbCRLF & vbCRLF & txtBmkNames
    end if
    End Sub
    </pre>


  9. #9
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Bookmarks (XP)

    Wow, Phil - where do you dredge these things up from? - I don't even remember doing that one (but will gladly take credit!) <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Here are a couple more possibly useful macros for getting bookmark names - the first one is very useful if you are developing a template that uses lots of bookmarks, and you want to see a hard copy of all of the bookmark names, located next to each bookmark (always run this one in a copy of your document or template!).

    <pre>Public Sub TypeEachBmkName()
    'Inserts name of bookmark, after each bookmark in document
    'Only use in a COPY of your document or template!
    Dim aBmk As Bookmark
    Dim strBmkName As String

    For Each aBmk In ActiveDocument.Bookmarks
    strBmkName = aBmk.Name
    aBmk.Range.InsertAfter strBmkName
    Next aBmk

    End Sub
    '* * * * * * * * *
    Public Sub GetBMKNameAndStartPos()
    'Prints name and position of each bookmark into the Immediate window
    Dim aBmk As Bookmark
    Dim lngBmkStart As Long
    For Each aBmk In ActiveDocument.Bookmarks
    lngBmkStart = aBmk.Range.Start
    Debug.Print aBmk.Name & " - " & lngBmkStart & vbCrLf
    Next aBmk

    End Sub
    </pre>

    Gary

  10. #10
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Bookmarks (XP)

    I appreciate all the help since I usually use Access and only recently started using VBA in Word.
    However, why is this not a normal view that should be built in? Are there any 'Softies out there listening?
    Zave

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    <hr>where do you dredge these things up from? - I don't even remember doing that one<hr>
    I quietly save so many things I read that even I can't usually find them. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Thanks for the additional ones.

  12. #12
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    This is just what I need.
    Anyone know how to format this script so the bookmarks are more obvious?
    Also pointing it to a UNC subdirectory would be helpful as opposed to just <font color=red>ActiveDocument.bookmarks</font color=red>
    I'd like to do this to an entire library of Docs...copies of course

  13. #13
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Bookmarks (XP)

    DJ,

    Would going to Tools > Options > View and turning on the showing of bookmarks, suffice for making them more obvious? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Here's a variant of the previous macros, that types the name of the bookmark after each bookmark, and also marks each bookmark with a symbol. If it's a 'collapsed' bookmark, the symbol should be an I-beam but I couldn't locate a suitable symbol, therefore have substituted a double dagger. If it's a 'wrapped' bookmark, left and right square brackets are inserted at the start and end of each bookmark's range. Does this do what you had in mind?

    Cycling through a number of documents and performing a task on them is a different issue; I can post some sample code to do that, but not right at this moment. Have a search here and see if anything useful turns up. If not, I can post some sample code later today.
    <pre>Public Sub TypeNameOfAndMarkEachBookmark()

    Dim aBmk As Bookmark
    Dim strBmkName As String
    Dim lngBmkStart As Long
    Dim lngBmkEnd As Long

    'Insert name after each bookmark
    For Each aBmk In ActiveDocument.Bookmarks
    strBmkName = aBmk.Name
    aBmk.Range.InsertAfter strBmkName
    Next 'aBmk

    'mark each bookmark with appropriate symbol
    For Each aBmk In ActiveDocument.Bookmarks
    lngBmkStart = aBmk.Range.Start
    lngBmkEnd = aBmk.Range.End
    If lngBmkStart = lngBmkEnd Then 'a collapsed bookmark, insert I-beam
    aBmk.Range.InsertAfter "

  14. #14
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks (XP)

    Actually, I was just wanting to format the text, like bold it for example.
    This would be easy if Word had intellisense.

    Oh, Tools/Options only shows the left angle bracket in place of the bookmark.
    We need to see the actual name of each bookmark.
    Is there another property or setting I missed?
    Thanks for the quick reply.

  15. #15
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Bookmarks (XP)

    Do you need to see the name of the bookmark in the text or would it suffice to add a comment around each bookmark. This might be cleaner because the bookmark name can be viewed if you are showing comments but otherwise the document is not impacted. If this suits you, the code to do this can be created easily.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •