TOC in Current Page

Description : Creates a table of contents from heading in the current page and inserts at the top of the page. Optionally it adds "Back to Top" links to the headings.


TOC in Current Page

You need Onetastic Add-in
for OneNote to run this macro.
Download Onetastic
Author(s) : Omer Atay
Category : TOC
Last Updated : December 17, 2017
Downloads : 30773
Watch this short video to learn more about this macro
Screenshot :

TOC in Current Page

Changelog :

December 17, 2017 (EA5512) - Omer Atay
Updated to refresh the TOC in the current page if it already exists.

September 04, 2016 (157AED) - Omer Atay
Now finds all the headers in the page, even if they are in a table.

August 16, 2016 (C55DB0) - Omer Atay
Re-added the option for "Back to Top" links, which was lost in the previous update.

July 30, 2016 (A20BF1) - Omer Atay
TOC now uses indents based on heading level so that it can be collapsed

June 20, 2016 (E0E260) - Omer Atay
Re-written with the new Macro Language to take advantage of cleaner syntax and performance improvements

These versions are no longer supported:

July 24, 2014 - Omer Atay
Added the option for "Back to Top" links.

March 17, 2013 - Omer Atay
Initial version


Nate Kaemingk - 2018-01-03
EA5512 has a slight bug with relative vs absolute links.  If I copy the notebook over to a new page all of the links go back to the original page, not the page I'm on.  

This can be fixed by re-running the macro... but unfortunately the macro doesn't refresh the "Back to Top" links even if the TOC content was updated to work for the page it's on.  All of the "back to top" links still go to the original page.  So the true fix is to run this twice, once with "back to top" unchecked to delete all of the "back to top" links, then again with "back to top" option checked which rebuilds.  

I should not have to jump through this many hoops to copy a page with a page specific TOC.
Omer Atay - 2017-12-17
AJ/Manu: Updated this macro to refresh the TOC in the current page if it already exists
Manu - 2017-12-14
This macro definitely adds great value to the OneNote.

Update with two suggestions as mentioned by "AJ - 2017-09-26" would be great and ease working on documents which are long and undergo frequent updates.