Help VBA

Help VBA

melo_gg
Explorer Explorer
1,326 Views
2 Replies
Message 1 of 3

Help VBA

melo_gg
Explorer
Explorer

Hello friends,
I'm reading a book that left me VBA, I'm starting and I was blocked with an error that tells me the program is the below error: the compilation error: Expected: end of instruction.
Is there anyone who can help me?

Thank you very much.

 

Option Explicit

Global SS As AcadSelectionSet
Global BLKS As AcadBlocks
Global BLK As AcadBlock
Global Grps(0 To 1) As Integer
Global Dats(0 To 1) As Variant
Global Filter1, Filter2 As Variant

Sub BlockCounter()
Grps(0) = 0: Dats(0) = "INSERT"
Grps(1) = 2: Dats(1) = ""
On Error Resume Next
Set SS = ThisDrawing.SelectionSets.Add("SS")
If Err.Number <> 0 Then
Set SS = ThisDrawing.SelectionSets.Item("SS")
End If
SS.Clear
Set BLKS = ThisDrawing.Blocks
Dim J As Integer
J = BLKS.Count 1
For I = 2 To J
Set BLK = BLKS.Item(I)
Dats(1) = BLK.Name
Filter1 = Grps
Filter2 = Dats
SS.Select acSelectionSetAll, , , Filter1, Filter2
Out$ = BLK.Name & " " & Str$(SS.Count)
BlockCount.ListBox1.AddItem Out$
SS.Clear
Next I
While 1 = 1
BlockCount.show
Wend
End Sub

0 Likes
1,327 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor

Remove the "1". It should just be

J = BLKS,Count

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

melo_gg
Explorer
Explorer

Thanks, I'll try.

0 Likes