Public AcadApp As AcadApplication Public AcadPre As AcadPreferences Public AcadDoc As AcadDocument Public AcadPaS As AcadPaperSpace Public AcadMoS As AcadModelSpace
Public Sub test()
On Error Resume Next Set AcadApp = GetObject("AutoCAD.Application") If Err Then Err.Clear Set AcadApp = CreateObject("AutoCAD.Application") If Err Then MsgBox "err!" & Err.Description Exit Sub End If End If
Set AcadPre = AcadApp.Preferences Set AcadDoc = AcadApp.ActiveDocument Set AcadPaS = AcadDoc.PaperSpace Set AcadMoS = AcadDoc.ModelSpace
Set sset AS AcadDoc.ActiveSelectionSet
Set ssnew = AcadApp.SelectionSets.Add("ss")
ssnew.Clear ssnew.SelectOnScreen
MsgBox "The layers in this drawing are: " & ssnew.Count
End Sub 好象不行呐^_^
初学者不知VB如何调用AUTOCAD请斑竹指教……