View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Marc C
 
Posts: n/a
Default How to insert an image file into Work AND have the file name d

Thank you very much for that Jay.

I got it to work - and now I want to ask if you could help me tweak it?

Is it possible to make 3 enhancements to the macro:
- only insert the file name into Word (as opposed to the file name and the
folder reference)
- add the file name to multiple images that I select for inserting into the
document (currently, if I select multiple images, it only brings the file
reference of the first image selected in the group)
- when inserting the images, is it possible to control the size (height &
width) of the images - could default to say 1.5cm x 1.5cm. If this needs to
be a separate macro - no problem.

You are helping me more than you know - thanks in anticipation.

Regards

Marc



"Jay Freedman" wrote:

Hi Marc,

There's nothing built-in to do that, but a macro would be easy.

You haven't given much detail about how you want this formatted, so
this macro should be considered just a first draft that you can tweak
to get what you want. See http://www.gmayor.com/installing_macro.htm
if needed.

Sub InsertPictureAndFileName()
Dim FileName As String
Dim dlg As Dialog

Set dlg = Dialogs(wdDialogInsertPicture)
If dlg.Show = -1 Then
FileName = dlg.Name
End If

If FileName = "" Then Exit Sub ' canceled

Selection.InsertAfter vbCr & FileName
Selection.Collapse wdCollapseEnd
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Wed, 3 May 2006 17:08:02 -0700, Marc C
wrote:

I need to insert a number of image files into Word, and for each image, I
need the file name to display below the image. Any ideas?
Cheers
Marc