They will not necessarily be blank
sections but rather section breaks that generate a blank page.
A section break controls lots of formatting in the section before the break. An
odd-page or even-page or next-page section break will give you a new page. The even-page and odd-page breaks may generate a blank page.
When to use Section breaks in Microsoft Word
How are you producing these invoices that they have these section breaks? Mail merge? If so, look to your primary merge document.
Something other than section breaks may also be causing blank pages. See
Deleting “Blank” Pages by Suzanne Barnhill, MVP.
I am not going to attempt to write a macro on this. I think it is beyond my comfort level. However, to have such a macro, you need to analyze your situation and what it is you need the macro to do for you. This analysis needs to be in terms of the document structure rather than what it is you are seeing. A macro can only work with the Word's understanding of what is in the document.