Working with floating objects (graphics or text boxes) in headers and footers is problematic for VBA. There have been posts in the past which have discussed this that you might gain an insight from.
https://www.msofficeforums.com/word-...all-pages.html
https://www.msofficeforums.com/word-...en-though.html
Rather than trying to address that though, I would first challenge your initial design decision.
Quote:
If the bar were to be placed in a table, this table would always be the same with regardless of the page layout. Unlinking the footer and setting the table to "AutoFit Window" will fill the correct width, but also widens the ends. To overcome this I have set a tab-stop at the correct width, followed by a right alignment tab, applied the correct shading to both parts and placed an inline textbox of the correct width with the page number on the right. Up to here, this works perfectly.
|
You absolutely can control the table so it automatically adapts without widening ALL columns. Set up the TABLE so it has a preferred width of 100%. Then go to the columns tab and set:
Column 1 with a preferred width of x (cm or inches)
Column 2 with no preferred width
Column 3 with a preferred width of x (cm or inches)
Then you will find that you can change the page width and the table will adapt by only changing the width of the middle column.