Message 1 of 7
List of available blocks in a drawing using VBA
Not applicable
01-28-2010
10:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need to populate a list box with a list of available blocks in my drawing, however it is listing every block in the drawing one entry for each instance of the block. example if block "A" is present 100 times I've got 100 "A"'s in my list. How can I correct this. Some of my code is attached below.
'collect up list of all acad objects
For Each ObjEnt In ThisDrawing.ModelSpace
'sort out blocks
If ObjEnt.ObjectName = "AcDbBlockReference" Then
Set ObjBRef = ObjEnt
CmbBx_Blk_Fnd_Nm.AddItem ObjBRef.EffectiveName
'collect up list of all acad objects
For Each ObjEnt In ThisDrawing.ModelSpace
'sort out blocks
If ObjEnt.ObjectName = "AcDbBlockReference" Then
Set ObjBRef = ObjEnt
CmbBx_Blk_Fnd_Nm.AddItem ObjBRef.EffectiveName