groups inside

Hello,

How can I count groups with names that are inside the 'paper space'.  I think it's with screenrect and insideof, but i'm not sure.  For example all groups that being with 'Ref' that are in the 11x17 defined space.

Thanks!

Justin

Parents
No Data
Reply
  • Easy!

    Sub grCount()
         Dim s As Shape, SR As ShapeRange, kg As Long, kgn As Long, nm As String

         ActiveDocument.Unit = cdrInch
         nm = "Ref"
         Set s = ActivePage.SelectShapesFromRectangle(0, 0, 11, 17, False)
         Set SR = ActiveSelectionRange

         For Each s In SR
              If s.Type = 7 Then
                   kg = kg + 1
                   If Mid(s.Name, 1, 3) = nm Then kgn = kgn + 1
              End If
         Next s
         MsgBox "Groups count: " & kg & Chr(10) & "Groups with name " & Chr(34) & nm & "*" & Chr(34) & " count: " & kgn
    End Sub


    Regards
    Taras

Children
No Data