Insert Photo & Photo Name

K

Keith

How do I include the name of a photo inserted into a work doc without typing
it in each time?

ie.. Photo 034.jpg
 
D

Doug Robbins - Word MVP

Running the following macro will allow you to select the picture that you
want to insert, then it inserts the picture and the name of the file after
the picture in a paragraph that is center aligned:

Dim txtPhotoPath as String
With Dialogs(wdDialogInsertPicture)
If .Show Then
txtPhotoPath = WordBasic.FilenameInfo$(.Name, 0)
End If
Selection.InsertAfter vbCr & txtPhotoPath
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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