View Single Post
 
Old 07-27-2016, 09:20 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,143
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Without knowing what's in your array (which is not defined in your macro) you probably need something like
Code:
Public Sub insertSectionPics(arSectionPics As Variant)
Dim oTable As Table
Dim oRng As Range, oCell As Range
Dim i As Long, j As Long
    Set oRng = ActiveDocument.Bookmarks("\page").Range
    oRng.Collapse 0
    oRng.InsertBreak wdSectionBreakNextPage
    oRng.start = oRng.start - 1
    oRng.Collapse 1
    Set oTable = ActiveDocument.Tables.Add(oRng, 1, 3)
    oTable.AutoFitBehavior (wdAutoFitFixed)
    j = 1
    For i = LBound(arSectionPics) To UBound(arSectionPics)
        If i > 0 And i Mod 3 = 0 Then
            oTable.Rows.Add
            j = j + 1
        End If
        Set oCell = oTable.Cell(j, i Mod 3 + 1).Range
        oCell.End = oCell.End - 1
        ActiveDocument.InlineShapes.AddPicture _
                FileName:=arSectionPics(i), _
                LinkToFile:=False, _
                Range:=oCell
    Next i
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote