View Single Post
 
Old 10-18-2016, 04:06 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following should do the trick.

Code:
Option Explicit

Sub AddBookmarkList()
Dim oBM As Bookmark
Dim oTable As Table
Dim i As Long
Dim oRng As Range
    Set oRng = ActiveDocument.Range(0, 0)
    Set oTable = oRng.Tables.Add(oRng, 1, 1)
    For i = 1 To ActiveDocument.Bookmarks.Count
        Set oBM = ActiveDocument.Bookmarks(i)
        ActiveDocument.Hyperlinks.Add _
                Anchor:=oTable.Cell(i, 1).Range, Address:="", _
                SubAddress:=oBM.Name, _
                ScreenTip:="", _
                TextToDisplay:="Goto Bookmarked Location " & oBM.Name
        If i < ActiveDocument.Bookmarks.Count Then
            oTable.Rows.Add
        End If
    Next i
lbl_Exit:
    Set oTable = Nothing
    Set oBM = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote