I thought it was easier that this. I have run into a road block and of all the examples I have found this code should work.
Basic, and I mean basic, I want to create two selection sets. I have learned that I need to check if they already exist, and if they do then delete them. Then make the selection sets again. What I want this simple code to do is look into the existing selectionsets and delete any that have the same names as the one I am about to create. Then do a simple display showing me that the selection set that I have created are in the drawing. I will then build my code off that.
Sub ChXrefGray()
Dim ASSS as acadselectionsets
Dim Ass, xxreflist, xxlayerlist as acadselectionset
Dim msg as string
Set ASSS = ThisDrawing.SelectionSets
For Each Ass In ASSS
If Ass.Name = "xreflist" Then
ASSS.Item("xreflist").Delete
Else
If Ass = "layerlist" Then
ASSS.Item("layerlist").Delete
Else
End If
Next
Set ssxreflist = ASSS.Add("XrefList")
Set sslayerlist = ASSS.Add("LayerList")
MsgBox "there are " & ThisDrawing.SelectionSets.Count & "Selection Sets in this drawing"
msg = vbCrLf & vbCrLf
For Each Ass In ASSS
AssName = Ass.Name
msg = msg & AssName
msg = msg & vbCrLf
Next
MsgBox msg
End Sub
Can't get more basic. But when I run the code, VB tells me that I have a Next statement with out a For statement. At the very beginning of the code. I hope someone can explain to me why my code does not work, but other examples of the same do.
Thanks all,
Alex