I think the following modification will do what you require. You will have to do your own translations for the input box and message boxes; and configure the lists with the values you want.
Donations? By all means visit my web site - linked from my signature.
Option Explicit
Sub AddPics_v4()
Application.ScreenUpdating = False
Dim i As Long, j As Long, c As Long, r As Long, NumCols As Long
Dim oTbl As Table, TblWdth As Single, StrTxt As String, RwHght As Single
Dim strList As String
Dim oCell As Range
Dim oRng As Range
On Error GoTo ErrExit
Start:
strList = InputBox("Enter the number of the required dropdownlist for this section" & vbCr & vbCr & _
"1) pictures of the car/overall impression" & vbCr & _
"2) pictures of the car/options/accessoires" & vbCr & _
"3) pictures of the car/damage" & vbCr & _
"4) Quit." & vbCr)
If Not IsNumeric(strList) Then
MsgBox "You must enter a number between 1 and 4!"
strList = ""
GoTo Start
End If
If Val(strList) > 4 Or Val(strList) < 1 Then
MsgBox "You must enter a number between 1 and 4!"
strList = ""
GoTo Start
End If
If Val(strList) = 4 Then GoTo ErrExit
NumCols = CLng(InputBox("Hoeveel kolommen per rij?"))
RwHght = CSng(InputBox("Welke rij-hoogte voor de afbeeldingen, in inches (bijv. 1.5)?"))
On Error GoTo 0
'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 NumCols-column table to take the images
Set oRng = Selection.Range
If oRng.Start > ActiveDocument.Range.Start Then
oRng.Text = vbCr
oRng.Collapse 0
End If
Set oTbl = oRng.Tables.Add(Range:=oRng, NumRows:=2, NumColumns:=NumCols)
With ActiveDocument.PageSetup
TblWdth = .PageWidth - .LeftMargin - .RightMargin - .Gutter
End With
With oTbl
.AutoFitBehavior (wdAutoFitFixed)
.Columns.Width = TblWdth / NumCols
End With
For i = 1 To .SelectedItems.Count Step NumCols
r = ((i - 1) / NumCols + 1) * 2 - 1
'Format the rows
Call FormatRows(oTbl, r, RwHght)
For c = 1 To NumCols
j = j + 1
'Insert the Picture
ActiveDocument.InlineShapes.AddPicture _
Filename:=.SelectedItems(j), LinkToFile:=False, _
SaveWithDocument:=True, Range:=oTbl.Cell(r, c).Range
'Insert the Caption on the row below the picture
Set oCell = oTbl.Cell(r + 1, c).Range
oCell.End = oCell.End - 1
Call AddDropdown(oCell, Val(strList))
'Exit when we're done
If j = .SelectedItems.Count Then Exit For
Next
'Add extra rows as needed
If j < .SelectedItems.Count Then
oTbl.Rows.Add
oTbl.Rows.Add
End If
Next
Else
End If
End With
ErrExit:
Application.ScreenUpdating = True
End Sub
Sub AddDropdown(oRng As Range, iList As Long)
Dim objCC As ContentControl
oRng.InsertBefore vbCr
Set objCC = oRng.ContentControls.Add(wdContentControlDropdownList)
'List items
Select Case iList
Case 1
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Equine"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"
Case 2
objCC.DropdownListEntries.Add "Banana"
objCC.DropdownListEntries.Add "Pear"
objCC.DropdownListEntries.Add "Orange"
Case 3
objCC.DropdownListEntries.Add "Apricot"
objCC.DropdownListEntries.Add "Peach"
objCC.DropdownListEntries.Add "Melon"
End Select
lbl_Exit:
Set objCC = Nothing
Exit Sub
End Sub
'FormatRows Macro
Sub FormatRows(oTbl As Table, x As Long, Hght As Single)
With oTbl
With .Rows(x)
.Height = InchesToPoints(Hght)
.HeightRule = wdRowHeightExactly
End With
With .Rows(x + 1)
.Height = CentimetersToPoints(0.5)
.HeightRule = wdRowHeightExactly
End With
End With
End Sub