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 / July 2005

Tip: Looking for answers? Try searching our database.

FINDING IMAGES IN DOCUMENTS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ - 13 Jul 2005 06:47 GMT
How can I search in VBA for images in word docs, headers and footers
which are not inline images? I have tried searching for ^g and it
doesn't find the one's which are not "in line". Any suggestions?
Jay Freedman - 13 Jul 2005 14:34 GMT
> How can I search in VBA for images in word docs, headers and footers
> which are not inline images? I have tried searching for ^g and it
> doesn't find the one's which are not "in line". Any suggestions?

You haven't said what you want to do with them once you find them, so it's
hard to be specific. In general, you'd run a loop like this:

Dim oShp As Shape
For Each oShp in ActiveDocument.Shapes
  ' do something -- select, format, delete, etc.
Next oShp

Inside that loop, you can examine the value of oShp.Type to find out whether
it's an autoshape, a textbox, or something else, so you can be more exact
about which shapes you "do something" with.

If the document contains both floating and in-line shapes, you'll have to
handle them in separate loops because they're in separate collections.

Dim oILShp As InlineShape
For Each oILShp in ActiveDocument.InlineShapes
  ' do something -- select, format, delete, etc.
Next oILShp

The two types of shape objects have different properties and methods, so
what you can do with them differs.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

JJ - 14 Jul 2005 06:39 GMT
Hi Jay

I actually want to delete them and replace them with another image. The
logo of the company has changed and there are two different logo's
(.gif or .jpg image) in some documents. 1 in the header (not inline
shape). I will replace that logo with a big new logo and 1 in the
footer (not inline shape) and I want to replace that one with a small
logo. I am going to try what you have offered me and will get back. Now
that I have made it more clear perhaps you have other ideas as well.
Thanx in the meantime.

> > How can I search in VBA for images in word docs, headers and footers
> > which are not inline images? I have tried searching for ^g and it
[quoted text clipped - 27 lines]
> Jay Freedman
> Microsoft Word MVP          FAQ: http://word.mvps.org
 
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.