A family of Microsoft word processing software products for creating web, email, and print documents.
Instead of using a shape or text box, just apply shading to the heading paragraph, using the Shading dialog accessed from the Borders button in the Paragraph group on the Home tab.
To get the desired amount of spacing above and below the text, you must add a border the same color as the shading and then click the Options button in the Borders dialog.
In the Borders and Shading Options dialog you can set the distance from the text on each side.
This example shows a border and shading using the default settings:
If you want the sides of the shading to align with the left and right margins, you'll need to add indents equal to the width of the border and "From text" settings.
Another approach would be to put the heading in a single table cell and add shading, but the advantage of the above method is that the shading and other settings can be incorporated in the definition of the heading style.
If you want to persist with shapes (though I wouldn't advise it), you may be able to make it work by changing their wrapping to In Line With Text.