An alternative, which you may already have considered, is to make use of Word's built-in headings (these can be customized to suit your formatting needs). The heading styles have different names across the world, but they all respond to the \o switch: For example, { TOC \o "1-4" \h } bases the TOC on styles using Heading 1 through Heading 4.
__________________
Stefan Blom
Microsoft Word MVP
Microsoft 365 apps for business
Windows 11 Professional
|