View Single Post
  #1   Report Post  
Bluebird73 Bluebird73 is offline
Banned
 
Posts: 0
Talking Wishing to add "filenames" underneath the thumbnail photos

Hi all,

I was actually following a Word Learning Group via Email subscription back in 1997. I wonder if this forum is exactly that one. 21 years passed, and I've totally lost contact with that great group. I found Graham Mayor in the MVP and a guru in this forum. I remember he was leading the group back in 1997.

Today I need to create a word table of 3 columns and batch import my 50 photos into each cell and make each thrumbnail picture the same size. I also need to put the filenames of the photos right underneath each thumbnail. I googled and found a thread on this site that can do half the task - without being able to put the filename.

I am pasting the macro below. Hopefully, some kind friends could help me out.

Thank you so much.

----------------
Sub InsertMultipleImages()
Dim fd As FileDialog
Dim oTable As Table
Dim sNoDoc As String
Dim vrtSelectedItem As Variant
If Documents.Count = 0 Then
sNoDoc = MsgBox(" " & _
"No document open!" & vbCr & vbCr & _
"Do you wish to create a new document to hold the images?", _
vbYesNo, "Insert Images")
If sNoDoc = vbYes Then
Documents.Add
Else
Exit Sub
End If
End If
'add a 1 row 3 column table to take the images
Set oTable = Selection.Tables.Add(Selection.Range, 1, 3)
oTable.AutoFitBehavior (wdAutoFitFixed)
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Title = "Select image files and click OK"
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png"
.FilterIndex = 2
If .Show = -1 Then
oTable.Cell(1, 1).Select
For Each vrtSelectedItem In .SelectedItems
With Selection
.InlineShapes.AddPicture FileName:= _
vrtSelectedItem _
, LinkToFile:=False, SaveWithDocument:=True, _
Range:=Selection.Range
.MoveRight Unit:=wdCell
End With
Next vrtSelectedItem
Else
End If
End With
If Len(oTable.Rows.Last.Cells(1).Range) = 2 Then
oTable.Rows.Last.Delete
End If
Set fd = Nothing
End Sub