Hi,
I have a ms word 2003 document. I inserted an image into the header of the
document using Insert->Picture->From File.
I want to replace the image when the document is opened.
When the document is opened, it runs a macro which should find the image and
replace it with my own image.
In the macro, when I try to access the Header with the following code.
MsgBox
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes.Count,
vbOKCancel, "Shapes"
This is always returning 0, inspite of having an image in the header.
For the headers collections there is no InlineShapes object available also.
Is there any other way to access the images in the word 2003 document.
Any help is of great use.
Thanks
Sai
Lene Fredborg - 31 Oct 2007 18:47 GMT
If the wrapping style of the image is "In line with text", your image is an
InlineShape. You can access the InlineShape if you use the Range object:
MsgBox
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.InlineShapes.Count, _
vbOKCancel, "Shapes"

Signature
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
> Hi,
>
[quoted text clipped - 19 lines]
> Thanks
> Sai
saidevakumar - 31 Oct 2007 22:59 GMT
Thanks. I got it.
> If the wrapping style of the image is "In line with text", your image is an
> InlineShape. You can access the InlineShape if you use the Range object:
[quoted text clipped - 26 lines]
> > Thanks
> > Sai