API: COUNT COMPONENTS IN ASSEMBLIES

Hi there,

Can somebody give me any suggestion with this?:

Suppose that i have an assembly doc named " Test Assembly"  and contains: 4 components named "Part1", 6 components named "Part2" and 12 components named "Bolts".

If I write for example:

Dim sldworks as Object

DIm part as object

set sldworks= Application.sldworks

set part = sldworks.activedoc

part.extension.Selectbyid2("Part1-1@Test Assembly","component",....)

I would like to know how I can obtain the number FOUR (number of components named Part1) using other method or property... (in excel would be something like this "part.extension.selectbyid2(....).count")

I have tried with getcomponentcount but do not works as i want (return the number of all components in the assembly and do not support the selectbyid2 method). I know that a BOM do this automatically but i need obtain the number to do a custom bill in excel !!

Thanks in advance

Omar

SolidworksApi macros