Use a filtered selection set:
Dim ss As AcadSelectionSet
Dim fType, fData
Set ss = CreateSelectionSet
BuildFilter 0, "INSERT", 2, "S_*"
ss.Select acSelectionSetAll, , , fType, fData
Debug.Print "Total blocks = " & ss.Count
See the VB section of my site for the CreateSelectionSet and BuildFilter
functions.
--
http://www.acadx.com
Good judgement comes from experience.
Experience comes from bad judgement.
"Sean" wrote in message
news:B3CA88363A616A28E91A1DCE05D58CD5@in.WebX.maYIadrTaRb...
> This is more of a database question but here goes: I think it is pretty
> basic.
> I am using VBA/ADO to count the number of blocks in a drawing. I am trying
> to count (or sum) the number of blocks whose names begin with "S_" (e.g.
> S_1, S_2, S_3). E.g., if there are three of each of the blocks, the sum
> would be nine.
> Can anyone help?
> Thanks.....Sean
>
>