Mavila
08-05-2015, 01:55 PM
Hi, I've run into a puzzling result when trying to select a shape in a section's footer. It select's the wrong section's footer shape.
My code is:
ActiveDocument.Sections(ActiveDocument.Sections.Count).Footers(wdHeaderFoot erFirstPage).Range.ShapeRange(1).Select
The code creates a page, inserts content and then creates a section break (next page) and repeats (creates content in the next section and so on). Each page has a footer which is a rectangle shape that contains a table with a title for the section, page numbering and some other data.
It works fine for the first section, but when I run the above code on the second section, it selects the shape on the first page of the first section - not the first page shape in the second section.
I do this a couple of different ways depending on the type of document selected by the user. I don't encounter this problem when I run it on a document with the portrait orientation, but it happens when I run it on a landscape orientation - could that account for the problem?
I've inserted, msgbox Activedocument.sections.count and it correctly returns 2, but the above code still selects the first page footer shape in section #1.
Any ideas what might be going on here?
My code is:
ActiveDocument.Sections(ActiveDocument.Sections.Count).Footers(wdHeaderFoot erFirstPage).Range.ShapeRange(1).Select
The code creates a page, inserts content and then creates a section break (next page) and repeats (creates content in the next section and so on). Each page has a footer which is a rectangle shape that contains a table with a title for the section, page numbering and some other data.
It works fine for the first section, but when I run the above code on the second section, it selects the shape on the first page of the first section - not the first page shape in the second section.
I do this a couple of different ways depending on the type of document selected by the user. I don't encounter this problem when I run it on a document with the portrait orientation, but it happens when I run it on a landscape orientation - could that account for the problem?
I've inserted, msgbox Activedocument.sections.count and it correctly returns 2, but the above code still selects the first page footer shape in section #1.
Any ideas what might be going on here?