Jump to content

VBA Selction sets. Select a list of blocks that exist on a specific layer


Recommended Posts



I have this code;


Sub selectABlockOnALayer()

Dim sset As AcadSelectionSet

Set sset = ThisDrawing.SelectionSets.Add("EXCEPTIONS-BLOCK3")


Dim filterType As Variant

Dim filterData As Variant

Dim p1(0 To 2) As Double

Dim p2(0 To 2) As Double


Dim grpCode(0 To 1) As Integer

grpCode(0) = 8

grpCode(1) = 2

filterType = grpCode


Dim grpValue(0 To 1) As Variant

grpValue(0) = "FXPM"

grpValue(1) = "4PLUG"

filterData = grpValue


sset.Select acSelectionSetAll, p1, p2, filterType, filterData


Debug.Print "Entities: " & str(sset.count)




End Sub

I understand the code only selects 1 type of block on a layer but I cant even get that to work!


I am trying to select 89 different types of block that exist on a specific layer.


Is this something that can be done using VB?


Any advice would be great.





Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...