Header Macro Doesn't Insert Image into Sections
Posted on 2011-09-26
A while back we developed a macro to add an image to the header of a word document (linked question). The macro has been working fine, but recently I have been running into an issue where it does not add the image after certain section brakes in Word. But if I delete the section break and re-add it, then run the macro it will add the image to all pages of the Word document.
I am generating my Word documents through another program, and when you generate a certain document it will add a section break between two pages. This is where my macro fails, it will only insert the image into the header for the pages before the section break. But, if I delete the section break and re-add it, the macro will work fine. Other documents I generate through the program work fine, so I am confident it has nothing to do with the way the documents are getting generated.
When the macro fails I do not get any errors, so the syntax is correct. Please let me know if you need any more information. I have added the macro and the function it calls below.