Is is possible to display and print file names for .jpeg graphics embedded in
a Word 2003 document? I would like to be able to specify a place on page for
the original file name (preferably not, but possibly, the entire file path
name) to appear, a different name (of course) for each graphic. I envision
one graphic per page times dozens of pages, each graphic having its original
file name printed on its page. These are photographic images stamped with
file names by the cameras.
It depends on what you mean by "embedded". If you link to the files,
the link is a field containing the file's path and name, and a macro
can add that information as plain text below the picture. If you
simply paste the picture into the document, Word doesn't have any
information about where it came from, and there's nothing left to work
with.
To link to a picture file, use the Insert > Picture > From File
command; in the dialog, after selecting the file, click the down arrow
next to the Insert button and choose either "Link to File" or "Insert
and Link".
To make the macro work, the picture has to be in line with text, not
floating (Square, Top & Bottom, etc.). In Tools > Options > Edit, set
the default for pasting pictures to In Line With Text. If you need to
position the picture on the page, link it into a cell of a table.
For the macro, use this (see
http://www.gmayor.com/installing_macro.htm if needed):
Sub ShowPictureNames()
Dim picFld As Field
Dim picCode As Variant
Dim picPath As String
For Each picFld In Selection.Paragraphs(1).Range.Fields
If picFld.Type = wdFieldIncludePicture Then
picCode = Split(picFld.Code.Text, Chr(34))
picPath = picCode(1)
picPath = Replace(picPath, "\\", "\")
Selection.InsertAfter vbCr & picPath
Selection.Collapse wdCollapseEnd
End If
Next
End Sub
Run the macro (from a toolbar button or keyboard shortcut) when either
the picture itself is selected or the cursor is in the same paragraph
with the picture.