Sub kollaj()
Dim s() As Shape, p() As Shape, gr() As Shape
Dim i As Integer
Dim path, path1 As String
Dim n, metka As Integer
Dim x, y, max As Double
Dim FSO
n = 50
ReDim s(n)
ReDim p(n)
ReDim gr(n)
Dim doc1 As Document
Set doc1 = CreateDocument()
ActiveDocument.Unit = cdrMillimeter
Randomize
x = 0
y = 0
metka = 1
max = 0
path1 = Application.CorelScriptTools.GetFolder(, "Îòêóäà áðàòü...")
Set FSO = CreateObject("Scripting.FileSystemObject")
For i = 1 To FSO.GetFolder(path1).Files.Count
path = path1 + "\" + CStr(i) + ".jpg"
ActiveLayer.Import path
Set s(i) = ActiveSelection.Group
s(i).PositionX = x
s(i).PositionY = y
s(i).SizeHeight = s(i).SizeHeight * (40 / s(i).SizeWidth)
s(i).SizeWidth = 40
Set p(i) = ActiveLayer.CreateRectangle2(x, y, s(i).SizeWidth, s(i).SizeHeight)
p(i).PositionX = x
p(i).PositionY = y
p(i).Outline.SetProperties 2, OutlineStyles(0), CreateCMYKColor(0, 0, 0, 0), ArrowHeads(0), ArrowHeads(0), False, False, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, , , 5#
p(i).Fill.UniformColor.CMYKAssign 0, 0, 0, 0
p(i).CreateDropShadow cdrDropShadowFlat, 50, 5, 0.5, -0.5, CreateCMYKColor(0, 0, 0, 100), cdrFeatherAverage, cdrEdgeLinear, MergeMode:=cdrMergeMultiply
p(i).OrderBackOne
ActiveDocument.CreateSelection s(i), p(i)
Set gr(i) = ActiveSelection.Group
gr(i).Rotate Int(Rnd(10) * 20) - 10
metka = metka + 1
If metka > 8 Then
metka = 1
y = y - max
max = 0
x = 0
Else
x = x + gr(i).SizeWidth - 5
End If
If gr(i).SizeHeight > max Then max = gr(i).SizeHeight
Next i
End Sub