In your question you are referring to both headings and headers. This has confused me.
What is the difference between headings and headers?
See
How to create numbered headings or outline numbering in Ribbon Versions of Word by Shauna Kelly which allows up to nine levels of numbering in headings and allows inclusion of previous levels as part of the numbering. This is not a macro but rather linking numbering to styles.