A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Wishing to add "filenames" underneath the thumbnail photos



 
 
Thread Tools Display Modes
  #1  
Old May 8th 18, 04:16 PM
Bluebird73 Bluebird73 is offline
Banned
 
First recorded activity by WordBanter: May 2018
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
Ads
  #2  
Old May 12th 18, 01:32 PM
Bluebird73 Bluebird73 is offline
Banned
 
First recorded activity by WordBanter: May 2018
Posts: 0
Wink

Quote:
Originally Posted by Bluebird73 View Post
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


I've not seen any replies to this thread. Hopefully, some expert could help me out. Thank you so much.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"how to format the picture size of several photos simultaneously" Marcos Melendez Microsoft Word Help 1 September 28th 07 05:54 AM
I can't find the symbol "s" with a dot underneath Tom Microsoft Word Help 2 July 9th 07 03:59 PM
Need template for "New Employee" bulletin/listing with photos Sorcerer Mickey Microsoft Word Help 2 April 6th 06 06:40 AM
"Template for digital photos and captions" Mike Servat Page Layout 1 December 30th 05 04:37 PM
How to "auto merge" 50 photos into 50 Word pages? focusmankc Microsoft Word Help 1 December 30th 05 06:49 AM


All times are GMT +1. The time now is 05:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.