R
Robin
I may be getting my objects mixed up here, but this is the situation. I have
a document that has three sections. Each section has a different header and
footer with a different number linked images and other shapes in it. The
heading and footer used in an entire section is the same - no variations for
first page or numbered pages in that section.
When I count the number of shapes in each header/footer using the Count
property on the Shapes object, it tells me there are 16 shapes in each. This
is not correct, it is 16 for the entire document, so why is it not specific
for each section?
The code I have is as follows:
SubSub CleanHeader()
Dim s As Section
Dim j As Shape
Dim myRange As Range
Dim i As Integer
Dim n As Integer
' First we did a straight count on each section - they all gave 16 which is
wrong
MsgBox ("total 1: " &
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes.Count)
MsgBox ("total 2: " &
ActiveDocument.Sections(2).Headers(wdHeaderFooterPrimary).Shapes.Count)
MsgBox ("total 3: " &
ActiveDocument.Sections(3).Headers(wdHeaderFooterPrimary).Shapes.Count)
' Then we did a systematic count - they also gave 16 which is wrong
For Each s In ActiveDocument.Sections
n = 0
For Each j In s.Headers(wdHeaderFooterPrimary).Shapes
n = n + 1
Next j
MsgBox ("total: " & n)
Next s
End Sub
Any help appreciated.
thanks
Robin
a document that has three sections. Each section has a different header and
footer with a different number linked images and other shapes in it. The
heading and footer used in an entire section is the same - no variations for
first page or numbered pages in that section.
When I count the number of shapes in each header/footer using the Count
property on the Shapes object, it tells me there are 16 shapes in each. This
is not correct, it is 16 for the entire document, so why is it not specific
for each section?
The code I have is as follows:
SubSub CleanHeader()
Dim s As Section
Dim j As Shape
Dim myRange As Range
Dim i As Integer
Dim n As Integer
' First we did a straight count on each section - they all gave 16 which is
wrong
MsgBox ("total 1: " &
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes.Count)
MsgBox ("total 2: " &
ActiveDocument.Sections(2).Headers(wdHeaderFooterPrimary).Shapes.Count)
MsgBox ("total 3: " &
ActiveDocument.Sections(3).Headers(wdHeaderFooterPrimary).Shapes.Count)
' Then we did a systematic count - they also gave 16 which is wrong
For Each s In ActiveDocument.Sections
n = 0
For Each j In s.Headers(wdHeaderFooterPrimary).Shapes
n = n + 1
Next j
MsgBox ("total: " & n)
Next s
End Sub
Any help appreciated.
thanks
Robin