Dear people of msofficeforums,
I have a VBA script, sourced from this forum (
https://www.msofficeforums.com/word-...html#post47919), which works wonders.
It looks like this:
I want it to look like this (i want to remove the numbering from the image)
This is the code:
Code:
CaptionLabels.Add Name:="Step"
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
Set iShp = ActiveDocument.InlineShapes.AddPicture( _
FileName:=.SelectedItems(j), LinkToFile:=False, _
SaveWithDocument:=True, Range:=oTbl.Cell(r + 1, c).Range)
With iShp
.LockAspectRatio = True
If (.Width < ColWdth) And (.Height < RwHght) Then
.Width = ColWdth
If .Height > RwHght Then .Height = RwHght
End If
End With
StrTxt = ""
With oTbl.Cell(r, c + 1).Range
.Paragraphs.Alignment = wdAlignParagraphCenter
.InsertBefore vbCr
.Characters.First.InsertCaption _
Label:="Step", Title:=StrTxt, _
Position:=wdCaptionPositionBelow, ExcludeLabel:=False
.Characters.First = vbNullString
.Characters.Last.Previous = vbNullString
End With
'Insert the Caption on the row below the picture
CaptionLabels.Add Name:="Image"
'Get the image filename
StrTxt = Split(.SelectedItems(j), "\")(UBound(Split(.SelectedItems(j), "\")))
StrTxt = ": " & Split(StrTxt, ".")(0)
With oTbl.Cell(r, c).Range
.InsertBefore vbCr
.Characters.First.InsertCaption _
Label:="Image", Title:=StrTxt, _
Position:=wdCaptionPositionBelow, ExcludeLabel:=False
.Characters.First = vbNullString
.Characters.Last.Previous = vbNullString
End With
'Exit when we're done