TOC in Current Page

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.


Author(s) : Onetastic ★
Category : TOC
Last Updated : August 08, 2022
Requirements : OneNote 2010 or above
Watch this short video to learn more about this macro
Screenshot :

TOC in Current Page

Include headings up to
Changelog :

August 08, 2022 (EFAC69) - Onetastic ★
Fixed an issue where the macro will fail with an error on some pages with images

May 14, 2022 (9F1898) - Onetastic ★
Fixed a bug where page content would be removed if it consists of tables or other non-text content

January 17, 2022 (EE2A63) - Onetastic ★
Added option to have the TOC contain list numbers if the headings are part of a numbered list.

December 07, 2020 (10CBCC) - Onetastic ★
Added option to choose heading level for TOC

May 28, 2018 (CF836A) - Onetastic ★
Fixed an issue where the macro will fail with an error

April 24, 2018 (1B3508) - Onetastic ★
Fixed an issue where the "Back to Top" links wouldn't be updated if they already exist. Also the macro will now remember the "Back to Top" setting.

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

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

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

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

June 20, 2016 (E0E260) - Onetastic ★
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 - Onetastic ★
Added the option for "Back to Top" links.

March 17, 2013 - Onetastic ★
Initial version


Josep - 2022-08-26
Updated as of August, 28, 2022.
When inserting the TOC, headers #2 are not indented (they are at the same level as headers #1). Headers #3 are correctly indented.
Also, selecting "list numbers" doesn't seem to have any effect.

Other than that, thanks for an excellent tool.
Dan Beckvall - 2022-02-17
Is there a way to install these Macros without the Onetastic addon?  PC policies don't let me install the addon but I can make my own macro and paste in the code.
stachu99 - 2022-01-23
Thanks Omer for the last update (January 17, 2022).
Show more comments (104 more)