Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert Multiple Pictures into different table cells in MS Word

Posted on 2013-05-14
5
Medium Priority
?
7,883 Views
Last Modified: 2015-01-16
Hi Experts,

This is probably really simple but its driving me crazy. I am trying to insert a lot of pictures into a word table because I need to get two of them per page.

I create the table and set the exact size I want so the table doesnt adjust to the size of the picture and it works well. I can insert pictures one by one and its no problem. However since there are MANY pictures, I select the whole table and then try to import the pictures so I can get 1 per cell... but they seem to be imported to the first cell instead of 1 per cell. I tried this also with copy and pasting the pictures with the same results.

Anyone have a workaround?

Thanks in advance!
0
Comment
Question by:Nauj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
BurundiLapp earned 500 total points
ID: 39165138
It's a little convoluted but possible to a degree.

In a blank page insert all your pictures
go back to the top of the document and press the left arrow key
put in a comma
repeat for however many columns you will have in your table
whenever a new row should start (i.e after say 6 pictures) then press enter instead of putting a comma in.

When done

Select all ( CTRL + A )
In Word 2010 click the 'insert' ribbon bar bar
Then click the dropdown arrow under Table
Choose convert text to table, it should have detected you are using commas to seperate the pictures and detected the correct number of columns due to you putting in paragraph returns instead of commas.

Once this has been done you'll have all the pictures in consecutive cells in a table, you can then resize the table to how it should be, not sure if the pictures will need resizing as well, it depends on the way they look.
0
 
LVL 14

Assisted Solution

by:Stacy Brown
Stacy Brown earned 500 total points
ID: 39165176
I think you are stuck unless you have all the pictures in a database or in Excel.  Then you could use mailmerge.

I found this code here that may help:  http://www.vbaexpress.com/forum/showthread.php?t=44473

Sub AddPics() 
    Application.ScreenUpdating = False 
    Dim oTbl As Table, i As Long, j As Long, k As Long, StrTxt As String 
     'Select and insert the Pics
    With Application.FileDialog(msoFileDialogFilePicker) 
        .Title = "Select image files and click OK" 
        .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png" 
        .FilterIndex = 2 
        If .Show = -1 Then 
             'Add a 2-row by 2-column table with 7cm columns to take the images
            Set oTbl = Selection.Tables.Add(Selection.Range, 2, 2) 
            With oTbl 
                .AutoFitBehavior (wdAutoFitFixed) 
                .Columns.Width = CentimetersToPoints(7) 
                 'Format the rows
                Call FormatRows(oTbl, 1) 
            End With 
            CaptionLabels.Add Name:="Picture" 
            For i = 1 To .SelectedItems.Count 
                j = Int((i + 1) / 2) * 2 - 1 
                k = (i - 1) Mod 2 + 1 
                 'Add extra rows as needed
                If j > oTbl.Rows.Count Then 
                    oTbl.Rows.Add 
                    oTbl.Rows.Add 
                    Call FormatRows(oTbl, j) 
                End If 
                 'Insert the Picture
                ActiveDocument.InlineShapes.AddPicture _ 
                FileName:=.SelectedItems(i), LinkToFile:=False, _ 
                SaveWithDocument:=True, Range:=oTbl.Rows(j).Cells(k).Range 
                 'Get the Image name for the Caption
                StrTxt = Split(.SelectedItems(i), "\")(UBound(Split(.SelectedItems(i), "\"))) 
                StrTxt = ": " & Split(StrTxt, ".")(0) 
                 'Insert the Caption on the row below the picture
                With oTbl.Rows(j + 1).Cells(k).Range 
                    .InsertBefore vbCr 
                    .Characters.First.InsertCaption _ 
                    Label:="Picture", Title:=StrTxt, _ 
                    Position:=wdCaptionPositionBelow, ExcludeLabel:=False 
                    .Characters.First = vbNullString 
                    .Characters.Last.Previous = vbNullString 
                End With 
            Next 
        Else 
        End If 
    End With 
    Application.ScreenUpdating = True 
End Sub 
 '
Sub FormatRows(oTbl As Table, x As Long) 
    With oTbl 
        With .Rows(x) 
            .Height = CentimetersToPoints(7) 
            .HeightRule = wdRowHeightExactly 
            .Range.Style = "Normal" 
        End With 
        With .Rows(x + 1) 
            .Height = CentimetersToPoints(0.75) 
            .HeightRule = wdRowHeightExactly 
            .Range.Style = "Caption" 
        End With 
    End With 
End Sub 

Open in new window


Also, this Photo Gallery Addin from Greg Maxey that may help:

http://gregmaxey.mvps.org/word_tip_pages/photo_gallery_add_in.html
0
 
LVL 14

Expert Comment

by:Stacy Brown
ID: 39165185
BurundiLapp ....  That's a great idea!  I didn't even think of that.  Nice one!
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question