none
Modifying shapes in the header of juist one section using VBA RRS feed

  • Question

  • My aim is to insert a landscape section in a otherwise portrait document. In this landscape section all shapes should be moved and rotated to make sure that they appear at the same page position as in the portrait pages.

    So I need to identify which shapes are pertaining tot the header of this specific section.

    With constructions like

    For each ThisShape in ActiveDocument.Sections(2).Headers(wdHeaderFooterPrimary).Shapes

    not only shapes in the primary header of section 2 are returned, but ALL shapes in ALL headers and ALL footers of ALL sections.

    How can I identify the ones that pertain to section 2 only?


    • Edited by Jan Hemel Thursday, October 22, 2015 8:08 AM
    Thursday, October 22, 2015 8:08 AM

Answers

  • A suggestion by Cindy Meister in another thread brought me to an interesting finding:

    With the following code:

    For each ThisShape in ActiveDocument.Sections(2).Headers(wdHeaderFooterPrimary).Range.Shaperange

    only the shapes in the specified header  of section 2 seem te be returned. This will probably do the trick.

    Thanks Cindy (if you read this)!

    Thursday, October 22, 2015 9:18 AM

All replies

  • A suggestion by Cindy Meister in another thread brought me to an interesting finding:

    With the following code:

    For each ThisShape in ActiveDocument.Sections(2).Headers(wdHeaderFooterPrimary).Range.Shaperange

    only the shapes in the specified header  of section 2 seem te be returned. This will probably do the trick.

    Thanks Cindy (if you read this)!

    Thursday, October 22, 2015 9:18 AM
  • You're welcome, Jan :-)

    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Thursday, October 22, 2015 6:31 PM
    Moderator