Find Image Files in Word Document

M

mmikedm1000

Hi,
Is there a way to use a macro, or a report, to generate a list of all images
that are linked in a MS Word document.
 
M

mmikedm1000

I have a macro that will search for images, but how do I copy that
information into another document. I would like to have image name,
location, header text, source file name and location if at all possible.
Here is what I have thus far

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting

With Selection.Find
.Text = "^g"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
 
H

Helmut Weber

Hi Mike,

sorry to say so,
but there is no such thing as an image in Word,
that is to say, there is no image object in Word.

There are shapes and inlineshapes of a variety of types.
I couldn't find a caption property nor a header text property.
Nor can I see a location property in a straightforward way.

I think you are on the wrong track.

Though, this one might help you:

With ActiveDocument.Shapes(1)
MsgBox .LinkFormat.SourceFullName
End With
With ActiveDocument.InlineShapes(1)
.Select
MsgBox .LinkFormat.SourceName
End With

assuming, that the first shape
as well as the first inlineshape are linked.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
M

mmikedm1000

Helmut,

I think I may have worded my question poorly. My documents have objects
inserted from insert object, create from file, link to file. Those images
are the ones I want to see if it is possible to create a macro that would go
through a document and export pertinent information to another document. In
essence, for a large document telling me what images are in that document.
Is this at all possible?

Thanks for you help.
 
H

Helmut Weber

Hi Michael,
I think I may have worded my question poorly. My documents have objects
inserted from insert object, create from file, link to file. Those images
are the ones I want to see if it is possible to create a macro that would go
through a document and export pertinent information to another document. In
essence, for a large document telling me what images are in that document.

This is the hardest question of all.

I think, no, as when not linked, the inserted object,
lets say it is a picture, seems to become an entire part
of the doc and all it's traces are lost.

Sure you can loop through all inlineshapes and all shapes,
check whether they are linked or not, and if linked,
extract to what file they are linked.

You may obtain a list with autoshape1, autoshape2, etc.,
but this is certainly not what you want.

But, when inserting objects, here and now
Word offers 36 different types!

At least I couldn't manage, having inserted a wav-sound
as an inlineshape, which is the default,
to find out programmatically, what sound it was.

As lots of other people are reading here
and don't hesitate to speak up, if they know better
I'd say, no way. Or make a passion out of it,
and show us how to do it.

Every lesson is appreciated. ;-)

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
M

mmikedm1000

Thank you for your assistance.
--
Michael


Helmut Weber said:
Hi Michael,


This is the hardest question of all.

I think, no, as when not linked, the inserted object,
lets say it is a picture, seems to become an entire part
of the doc and all it's traces are lost.

Sure you can loop through all inlineshapes and all shapes,
check whether they are linked or not, and if linked,
extract to what file they are linked.

You may obtain a list with autoshape1, autoshape2, etc.,
but this is certainly not what you want.

But, when inserting objects, here and now
Word offers 36 different types!

At least I couldn't manage, having inserted a wav-sound
as an inlineshape, which is the default,
to find out programmatically, what sound it was.

As lots of other people are reading here
and don't hesitate to speak up, if they know better
I'd say, no way. Or make a passion out of it,
and show us how to do it.

Every lesson is appreciated. ;-)

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top