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

Code:
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
    Randomize
    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
    Next
End Sub
this code duplicates any selected shape and scatter it inside page
Reply With Quote