|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Creating Clickable alphabet Index
I am finding it difficult to create a collection of poems. It is surprising as I would have thought my requirement is pretty common. All I want is an alphabetic index which is hyperlinked to anchors. Then when I make changes in the future I would expect to be able to update the index to reflect those changes. I don't even mind paying for software that will do this but it appears there is nothing out there.
The closest I can find is a table of contents that I unlink and sort but if I update that I will lose the hyperlinks. |
#2
|
|||
|
|||
You have stated the situation in Word.
This is a user-to-user help forum with no pipeline to Microsoft. How do I give feedback on Microsoft Office? You can sort a Table of Contents without unlinking it. That means that if you update your content and TOC you will again need to sort it. Word will do the sorting for you but you have to tell it to do it each time. |
#3
|
||||
|
||||
Indexes in Word do not and cannot be made to hyperlink to anything. That's because Indexes can refer to multiple instances of an item on different pages. Tables of Contents can do such linking however, but they can't sort content. If you sort the content in the document body, once refreshed the Table of Contents will reflect the sorted order.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
||||
|
||||
You could create a Table of Contents, convert that to a table, then sort the table. The following macro does just that:
Code:
Sub CreateIndexTable() Dim TOC As TableOfContents, Rng As Range, Tbl As Table Dim StrBkMkList As String, StrStlList As String, StrTmp As String, i As Long With ActiveDocument If .Bookmarks.Exists("TblTOC") Then .Bookmarks("TblTOC").Range.Delete .Bookmarks("TblTOC").Delete End If Set TOC = .TablesOfContents.Add(Range:=Selection.Range, UseHeadingStyles:=True, IncludePageNumbers:=True) With TOC For i = 3 To .Range.Fields.Count StrBkMkList = StrBkMkList & "|" & Split(Trim(.Range.Fields(i).Code.Text), " ")(1) StrStlList = StrStlList & "|" & .Range.Paragraphs(i - 2).Style Next Set Rng = .Range .Delete End With Set Tbl = .Tables.Add(Range:=Rng, NumRows:=i - 2, NumColumns:=2) With Tbl .Borders.Enable = True .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 90 .Rows.Alignment = wdAlignRowCenter .Rows(1).HeadingFormat = True .Rows(1).Range.Style = "Strong" With .Columns(1) .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 90 End With With .Columns(2) .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 10 End With With .Cell(1, 1).Range .Text = "Poem" End With With .Cell(1, 2).Range .Text = "Page" End With End With For i = 1 To UBound(Split(StrBkMkList, "|")) StrTmp = Replace(Split(StrBkMkList, "|")(i), "Toc", "TblTOC") .Bookmarks.Add Name:=StrTmp, Range:=.Bookmarks(Split(StrBkMkList, "|")(i)).Range .Bookmarks(Split(StrBkMkList, "|")(i)).Delete Set Rng = Tbl.Cell(i + 1, 1).Range With Rng .Style = Split(StrStlList, "|")(i) .End = .End - 1 .Fields.Add Range:=Rng, Type:=wdFieldEmpty, Text:="REF " & StrTmp & " \h", PreserveFormatting:=False End With Set Rng = Tbl.Cell(i + 1, 2).Range With Rng .Style = Split(StrStlList, "|")(i) .End = .End - 1 .Fields.Add Range:=Rng, Type:=wdFieldEmpty, Text:="PAGEREF " & StrTmp & " \h", PreserveFormatting:=False .ParagraphFormat.Alignment = wdAlignParagraphRight End With Next Tbl.Range.Fields.Update Tbl.Sort ExcludeHeader:=True, FieldNumber:=1, SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending End With End Sub For PC macro installation & usage instructions, see: Installing Macros For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Alphabetical order TOC - Guidance appreciated on very complicated project
I am producing a book of song lyrics, with the second part of the book being "the story behind the song". I assume below is the only way I can do it? This is the format
TOC (This needs to be alphabetic so I have to create it, paste it into excel to sort and then past it back to word. SECTION 1 1. Song 1 Lyrics The story behind etc (Page number for print and link for ebooks) 2. Song 2 Lyrics The story behind etc (Page number for print and link for ebooks) SECTION 2 The story behind song 1 The story behind song 2 To generate page numbers I will need to create two TOC's by using bookmarks. The second TOC would be just to give me the page numbers for the stories which I assume I will have to enter manually. I can't see any way around this and worse still, if I make alternations the manually entered page numberers will be out. I know how to create the TOC's. Last edited by Charles Kenyon; 12-28-2020 at 04:26 PM. Reason: change title |
#6
|
|||
|
|||
Word TOCs can only be created in sequential order. That is the nature of a Table of Contents.
Word's Index feature will build a list in alphabetical order with page numbers. |
#7
|
|||
|
|||
I know. But I can't hyperlink index entries can I. TOC entries generate their own links which are carried to ebook formatting.
|
#8
|
||||
|
||||
Quote:
Kindly don't start multiple threads on essentially the same topic. The threads have now been merged.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by Charles Kenyon; 12-29-2020 at 01:34 PM. Reason: removed link that became circular upon merging of threads |
#9
|
|||
|
|||
My last thread concerned only TOC's which I accepted I have to use. This thread is asking about other problems I have and guidance on the project as a whole.
|
#10
|
|||
|
|||
The macro you gave me is fantastic but the page number is on a different line to the song title which creates an extra space. Is it possible to put them on the same line ?
|
#11
|
||||
|
||||
It doesn't do that when I run the macro - both entries are on the same line.
Since you don't have Word's formatting display turned on, it's impossible to tell from your screenshot what the problem is. I suspect, however that is has something to do with the formatting of the range you selected for the insertion.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Sorry, I just found out it was caused by the style. I changed it to normal style all is ok. I have been getting into a lot of trouble with styles which I have never used before. All is ok now but there is one last thing.
How can I change the macro so there are no headers generated? |
#13
|
||||
|
||||
The simplest solution is to insert:
Code:
Tbl.Rows(1).Delete Code:
End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
Perfect thanks. I really appreciate your help which has enabled me to put together my life's work.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Advice/Guidance on how to use and where to store Project Templates for Company Use | scyllanbay | Project | 0 | 12-24-2020 08:59 AM |
Need Some Guidance for my Project | NIDALAP | Project | 0 | 06-01-2017 05:05 AM |
Any help greatly appreciated new here | AldiJustin41 | Excel | 2 | 01-08-2017 03:46 PM |
Major Project Guidance | Project_Newb | Project | 1 | 03-26-2015 11:40 AM |
Column Merge - All help appreciated | shilabrow | Excel Programming | 1 | 02-07-2015 10:59 PM |