I have MS Word files that have a header with 2 Text Boxes and one image (as logo) and some tables, texts and images in body.
I’m trying to remove the image in header (logo) with this VBA code:
Dim tmp As Shape
Dim dShape As Shape
For Each tmp In ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes
If tmp.Type = msoPicture Then
Set dShape = tmp
End If
Next
dShape.Delete
In the first test it worked correctly! After that it removes body image instead of header image!!!
It seems we should first select the
Shapewe want to delete!!I don’t know why when I say
shape1.Deleteit thinks : let me see, mmmm… I think i is better to doshape2.Delete, so i’ll do that.any way this works:
VBA is a fool (Just like its platform)!