View Single Post
Old 10-07-2018, 03:14
shark shark is offline
Senior Member
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146

Sub FillRandShapes()
Const MaxSize = 15
Const MinSize = 5
Dim s As Shape, X#, Y#, w#, h#, z&
    ActiveDocument.Unit = cdrMillimeter
    ActivePage.GetBoundingBox X, Y, w, h
    Set s = ActiveShape: If s Is Nothing Then Exit Sub
    For z = 1 To 100
        Set s = s.Duplicate
        s.SetPosition X + Rnd * w, Y + Rnd * h
        s.SetSize Rnd * MaxSize + MinSize
End Sub
this code duplicates any selected shape and scatter it inside page
Reply With Quote