Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2020, 02:54 AM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 12-17-2020, 05:16 AM
Charles Kenyon Charles Kenyon is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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.
Reply With Quote
  #3  
Old 12-17-2020, 05:22 AM
macropod's Avatar
macropod macropod is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2010
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

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]
Reply With Quote
  #4  
Old 12-21-2020, 12:53 AM
macropod's Avatar
macropod macropod is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2010
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

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
Note: If you add/delete headings, you'll need to delete the table & run the macro again.

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]
Reply With Quote
  #5  
Old 12-28-2020, 03:49 PM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default 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
Reply With Quote
  #6  
Old 12-28-2020, 04:28 PM
Charles Kenyon Charles Kenyon is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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.
Reply With Quote
  #7  
Old 12-29-2020, 01:01 AM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default

I know. But I can't hyperlink index entries can I. TOC entries generate their own links which are carried to ebook formatting.
Reply With Quote
  #8  
Old 12-29-2020, 05:35 AM
macropod's Avatar
macropod macropod is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2016
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

Quote:
Originally Posted by delboy View Post
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.
Not really. See my last reply (above) to your previous thread on the same topic: Question asked: Creating clickable alphabet index.

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
Reply With Quote
  #9  
Old 12-29-2020, 06:11 AM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default

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.
Reply With Quote
  #10  
Old 01-02-2021, 12:12 PM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default

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 ?
Attached Images
File Type: jpg macro.jpg (18.1 KB, 21 views)
Reply With Quote
  #11  
Old 01-02-2021, 06:48 PM
macropod's Avatar
macropod macropod is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2016
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

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]
Reply With Quote
  #12  
Old 01-03-2021, 01:12 AM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default

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?
Reply With Quote
  #13  
Old 01-03-2021, 02:48 AM
macropod's Avatar
macropod macropod is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 10 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2016
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

Quote:
Originally Posted by delboy View Post
How can I change the macro so there are no headers generated?
The simplest solution is to insert:
Code:
  Tbl.Rows(1).Delete
before the final:
Code:
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 01-03-2021, 03:01 AM
delboy delboy is offline Alphabetical order TOC - Guidance appreciated on very complicated project Windows 7 Alphabetical order TOC - Guidance appreciated on very complicated project Office 2007
Novice
Alphabetical order TOC - Guidance appreciated on very complicated project
 
Join Date: Mar 2010
Posts: 23
delboy is on a distinguished road
Default

Perfect thanks. I really appreciate your help which has enabled me to put together my life's work.
Reply With Quote
Reply

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
Alphabetical order TOC - Guidance appreciated on very complicated project Any help greatly appreciated new here AldiJustin41 Excel 2 01-08-2017 03:46 PM
Alphabetical order TOC - Guidance appreciated on very complicated project Major Project Guidance Project_Newb Project 1 03-26-2015 11:40 AM
Alphabetical order TOC - Guidance appreciated on very complicated project Column Merge - All help appreciated shilabrow Excel Programming 1 02-07-2015 10:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:24 AM.


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