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 : December 16, 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 :

December 16, 2022 (9B42F1) - Onetastic ★
Fixed an issue where an empty line would appear before the last item in the TOC

December 13, 2022 (169982) - Onetastic ★
Added menu to quickly select the heading level. Fixed an issue where there would be extra space left after the TOC or TOC would be incorrectly generated when different levels are selected.

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


yandot - 2023-02-20
The empty line still appears before the last item in the TOC. Even in version December 16, 2022 (9B42F1)
Tiffany - 2022-12-27
Is it possible to use headings to create a TOC for the entire section?
Onetastic ★ - 2022-12-16
yandot: We published an update, please give it a try

mavencheesesticksneo: Sorry, there is no way to do that. OneNote scrolls the header into view and there is no way to change how it does that.
Show more comments (109 more)