Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

How to replace an image in the header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
saidevakumar - 31 Oct 2007 18:28 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.