View Single Post
 
Old 11-15-2015, 06:39 PM
priteshp108 priteshp108 is offline Windows 10 Office 2010 32bit
Novice
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default

Ok here is the macro that lists all the "bookmarked text" as cross-references.

I just need this list in alphabetical order by the **bookmarked text** instead of the **bookmark name**. Again the bookmark names are A_1, A_2, etc. The bookmarked text is the actual song title.

If you can help me with that, I would be very grateful.

Code:
Sub write_all_Cross_Refs()
    Dim bkMark As Bookmark
    Dim strMarks() As String
    Dim intCount As Integer

    If ActiveDocument.Bookmarks.Count > 0 Then
        ReDim strMarks(ActiveDocument.Bookmarks.Count - 1)
        intCount = 0
        For Each bkMark In ActiveDocument.Bookmarks
     Selection.InsertCrossReference ReferenceType:="Bookmark", ReferenceKind:= _
        wdContentText, ReferenceItem:=bkMark.Name, InsertAsHyperlink:=True, _
        IncludePosition:=False, SeparateNumbers:=False, SeparatorString:=" "
            intCount = intCount + 1
        Next bkMark
    End If
End Sub
Reply With Quote