Message 1 of 17
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need a little help, I have used this code in Acad 2024 and it worked fine, now I am at a company that is still running 2020. I am trying to use same snippet of code and it is erroring out on me.
I can’t figure out what I am doing wrong. Hopefully someone here can point in the right direction.
Sub testing()
‘set vars
Dim acadApp As Object
Dim sset As AcadSelectionSet
‘get Autocad
Set acadApp = GetObject(, "AutoCAD.Application")
‘get active drawing
Set acadDoc = acadApp.ActiveDocument
‘just checking to see if I got drawing
Debug.Print acadDoc.Name
‘delete any selection set
If acadDoc.SelectionSets.Count > 0 Then
Debug.Print Str(acadDoc.SelectionSets.Count)
acadDoc.SelectionSets(0).Delete
End If
‘get new selection set
Set sset = acadDoc.SelectionSets.Add("xx")
‘get an error "run-time error ’13:’ Type mismatch"
End Sub
Moderator edit: Please post your code in a code window.
Solved! Go to Solution.