View Single Post
 
Old 04-11-2015, 12:05 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

The following will do that, however if you are working with bookmarks, you should find http://www.gmayor.com/BookmarkandVariableEditor.htm useful:

Code:
Sub BMNames()
Dim oBM As Bookmark
Dim oRng As Range
Dim strList As String
    strList = ""
    If ActiveDocument.Bookmarks.Count > 0 Then
        For Each oBM In ActiveDocument.Range.Bookmarks
            strList = strList & oBM.name & vbCr
        Next oBM
        ActiveDocument.Range.InsertParagraphAfter
        Set oRng = ActiveDocument.Range
        oRng.Collapse 0

        oRng.Text = strList & vbCr & "The active document contains " & _
                    ActiveDocument.Bookmarks.Count & " bookmarks."
    Else
        MsgBox "There are no bookmarks in the document"
    End If
lbl_Exit:
    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