Thanks,
but...
not yet
it looked indeed as if it worked, when for the first time applied
This is the situation:
my document contains two different headers (first page and the rest) with
each a different picture.
I the want to cycle through different sets of pictures.
My code, enriched with the suggested code, now looks like this:
(the CycleVar is there for cycling purposes)
With ActiveDocument
'(first delete the existing picture)
..Sections(1).Headers(wdHeaderFooterFirstPage).Range.InlineShapes(1).Delete
'(then insert a picture)
.Sections(1).Headers(wdHeaderFooterFirstPage) _
.Shapes.AddPicture FileName:= "MyPic" & CycleVar & ".bmp", _
LinkToFile:=False, SaveWithDocument:=True
'(do the same for the following headers)
..Sections(1).Headers(wdHeaderFooterPrimary).Range.InlineShapes(1).Delete
.Sections(1).Headers(wdHeaderFooterPrimary) _
.Shapes.AddPicture FileName:= "MySmallPic" & CycleVar & ".bmp",
_
LinkToFile:=False, SaveWithDocument:=True
End With
when I execute it, it indeed removes/replaces the existing picture in the
header on the first page,
but, when trying to delete the picture in the following headers,
it complains about that second Delete with error 5941: the requested member
of the collection does not exist. or something like that
Experimenting with it learned that a picture put in the header by my code,
cannot be removed by this kind of Deleting.
Anybody?
Thanks anyway!
Michiel Rapati