View Single Post
 
Old 09-08-2020, 04:14 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Yep, a strange request. It is possible with a macro but I'm not sold on the usefulness and would also suggest an Index instead. If that doesn't suit...

You didn't specify how many levels the ToC goes to nor what you want for the Level 2+ paras either. What about actually rearranging the document into alphabetic order before building the TOC?

Assuming you want other levels and don't want to sort the lower levels, I would consider building a series of ToC fields with the bookmark switch working. To do this, create bookmarks around each 'section' eg from the first heading 1 to immediately before the next heading 1 you create the bookmark 'ahead'. The next section could be 'bhead' etc.
If the bhead section is alphabetically in front of ahead then the ToC fields could then be
{TOC \o "1-3" \b "bhead"}
{TOC \o "1-3" \b "ahead"}

You would still have to manually determine the bookmark order but if your Heading 1s don't change much then it probably isn't that onerous.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote