Selection sets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The routine below was developed to erase everything in a drawing and worked beautifully in windows7 but windows10 doesn't like the Set ssetObj = statement after CREATE_SET:
Public Sub ClearDrawing()
' Clears AutoCad drawing of all objects. Used in each connection module.
Dim ssetObj As AcadSelectionSet
On Error GoTo CREATE_SET
ThisDrawing.SelectionSets("MSset").Delete
GoTo SKIP_CREATE_SET
CREATE_SET:
Set ssetObj = ThisDrawing.SelectionSets.Add("MSset")
SKIP_CREATE_SET:
If ThisDrawing.ModelSpace.Count > 0 Then
ReDim ssobjs(0 To ThisDrawing.ModelSpace.Count - 1) As AcadEntity
Dim i As Integer
For i = 0 To ThisDrawing.ModelSpace.Count - 1
Set ssobjs(i) = ThisDrawing.ModelSpace.Item(i)
Next
ssetObj.AddItems ssobjs
ssetObj.Erase
End If
End Sub
Error code is Run-time error '91':
Object variable or With block variable not set.
Any ideas?