Help VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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