C
Chuck
Hi all
This is driving me mad -- in Word 2000...
I'm trying to delete logos from headers from one section at a time. When I
use the following code, even though I'm specifying the Shapes in a specific
section's headers, all the Shapes in all the headers are deleted:
Dim aheader As HeaderFooter
Dim myshape As Shape
For Each aheader In ActiveDocument.Sections(2).Headers
For Each myshape In aheader.Shapes
myshape.Delete
Next myshape
Next aheader
(The headers are not LinkedToPrevious.)
Word VBA help says the following about the Shapes Collection Object:
"To count the shapes in all the headers and footers, use the Shapes
collection with any HeaderFooter object."
This seems to imply that Shapes in headers/footers are somehow linked
regardless of whether the headers/footers are linked and that might explain
why using myshape.delete to delete one Shape would delete all Shapes.
However, I can manually delete individual Shapes (logos) from specific
section headers without affecting any other sections.
I've tried converting the Shapes to InlineShapes and then deleting the
InlineShapes (adapting the same code above but declaring myshape as
InlineShape) but the converted InlineShapes don't delete.
Any ideas about how to achieve the goal of getting rid of those logos from
specific section headers only without affecting any other headers?
Suggestions gratefully appreciated!
Chuck
This is driving me mad -- in Word 2000...
I'm trying to delete logos from headers from one section at a time. When I
use the following code, even though I'm specifying the Shapes in a specific
section's headers, all the Shapes in all the headers are deleted:
Dim aheader As HeaderFooter
Dim myshape As Shape
For Each aheader In ActiveDocument.Sections(2).Headers
For Each myshape In aheader.Shapes
myshape.Delete
Next myshape
Next aheader
(The headers are not LinkedToPrevious.)
Word VBA help says the following about the Shapes Collection Object:
"To count the shapes in all the headers and footers, use the Shapes
collection with any HeaderFooter object."
This seems to imply that Shapes in headers/footers are somehow linked
regardless of whether the headers/footers are linked and that might explain
why using myshape.delete to delete one Shape would delete all Shapes.
However, I can manually delete individual Shapes (logos) from specific
section headers without affecting any other sections.
I've tried converting the Shapes to InlineShapes and then deleting the
InlineShapes (adapting the same code above but declaring myshape as
InlineShape) but the converted InlineShapes don't delete.
Any ideas about how to achieve the goal of getting rid of those logos from
specific section headers only without affecting any other headers?
Suggestions gratefully appreciated!
Chuck