Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-15-2015, 10:19 AM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default Create Index List Using Bookmarks in Alphabetical Order

Hello, everyone. I have a dilemma. I need to create an index of over 1700 songs by alphabetical order, where the index entries (which are the song titles) have to be hyperlinked to the particular song in the word document. I have manually added all the index entries (song titles) but the index entries are not hyperlinked so they won't go to the particular song when clicked on. So when I generate the PDF, it won't go there.



However, I have also started to bookmark the song titles, where the bookmark names are A_1, A_2, A_3, A_4, etc. Then when I cross-reference the index entries to the bookmark name, the index entries in the PDF does go to the particular song. However, I'm trying to save manual work with a macro.

Can anyone help me with this macro. I did write a macro but the entries were not alphabetized. Instead the order was A_1, A_2, etc instead of the song title itself.
Reply With Quote
  #2  
Old 11-15-2015, 02:43 PM
macropod's Avatar
macropod macropod is offline Create Index List Using Bookmarks in Alphabetical Order Windows 7 64bit Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Is there a reason for not using a Table of Contents?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-15-2015, 03:54 PM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default

Yes. TOC gives you list that is not alphabetized. I do have a TOC but it is to organize the type of songs, since they are divided in sections. Each song is listed in TOC but it is not alphabetical hence one cannot find the song quickly without an alphabetic list like in an index.
Reply With Quote
  #4  
Old 11-15-2015, 04:23 PM
macropod's Avatar
macropod macropod is offline Create Index List Using Bookmarks in Alphabetical Order Windows 7 64bit Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Do your titles use Word's Heading Styles? If so, which?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-15-2015, 04:53 PM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default

It's a TOC level 2 if that's what your asking. Otherwise, I've defined a style called "Kirtan Title" for all the titles of the songs.
Reply With Quote
  #6  
Old 11-15-2015, 05:01 PM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default

What would be ideal is a macro that spits out the bookmarked entries in alpha order and links to that part of document without an index.

I have all titles bookmarked with names of the bookmarks as A_1, A_2, .... A_1750. Those entries to point to song titles. So the title has to be alphabetical order. Like this

Index
------
AAA is a song... 1 (bookmark name A_5)
BBB is a song ... 1 (bookmark name A_8)
CCC is a songs ... 2 (bookmark name A_1750)
.........
ZZZ is a song .... 567 (bookmark name A_10)

etc.

so bookmark names are random when song titles are concerned.
Reply With Quote
  #7  
Old 11-15-2015, 06:39 PM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
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
  #8  
Old 11-16-2015, 12:44 AM
macropod's Avatar
macropod macropod is offline Create Index List Using Bookmarks in Alphabetical Order Windows 7 64bit Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub MakeHyperlinks()
Application.ScreenUpdating = False
Dim oBkMrk As Bookmark, TblRng As Range, HLnkRng As Range, StrTxt As String, HLnk As Hyperlink
With ActiveDocument.Range
  .InsertAfter vbCr
  Set TblRng = .Characters.Last
  Set HLnkRng = .Characters.Last
  For Each oBkMrk In .Bookmarks
    With oBkMrk
      StrTxt = .Range.Text & vbTab & .Name
    End With
    With HLnkRng
      .Collapse wdCollapseEnd
      .Text = Split(StrTxt, vbTab)(0)
      Set HLnk = .Hyperlinks.Add(Anchor:=HLnkRng, SubAddress:=Split(StrTxt, vbTab)(1), _
        TextToDisplay:=Split(StrTxt, vbTab)(0))
      .End = HLnk.Range.End + 1
      .InsertAfter vbCr
    End With
  Next oBkMrk
  With TblRng
    .ConvertToTable Separator:=vbTab
    With .Tables(1)
      .Sort
      .ConvertToText
    End With
  End With
End With
Set HLnk = Nothing: Set TblRng = Nothing: Set HLnkRng = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 11-16-2015, 12:06 PM
priteshp108 priteshp108 is offline Create Index List Using Bookmarks in Alphabetical Order Windows 10 Create Index List Using Bookmarks in Alphabetical Order Office 2010 32bit
Novice
Create Index List Using Bookmarks in Alphabetical Order
 
Join Date: Nov 2015
Posts: 6
priteshp108 is on a distinguished road
Default

Thanks, man! I cannot make one bit sense of that but it works. It's exactly what I wanted. You saved me hours of work.

It took a long time since I have over 1700 songs but it finally did it.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Index List Using Bookmarks in Alphabetical Order List Style Numbering picks up out of order number from LATER list spthomas Word 12 12-16-2013 05:23 PM
Create Index List Using Bookmarks in Alphabetical Order Alphabetical Sort - result not alphabetical! hanvyj Excel 3 10-14-2013 10:59 PM
O 2007 folders & files lose alphabetical order in John Seed Outlook 0 02-28-2012 05:56 PM
Create Index List Using Bookmarks in Alphabetical Order Find in alphabetical order list 14spar15 Word 1 12-03-2011 03:01 PM
Some contacts are not in alphabetical order in Outlook 2007 marko959 Outlook 0 04-21-2011 01:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft