在VB.NET2005中,执行以下代码设置当前图层时,如果引用了AutoCAD则没问题,如果没引用的话,最后一句会出错,谁能帮我处理一下? dim myc as object dim mydwg as object dim aclay as object Myc = GetObject(, "AutoCAD.Application") If Err.Number <> 0 Then Myc = CreateObject("AutoCAD.application", ) Err.Clear() End If Myc.Visible = True Mydwg = Myc.ActiveDocument For Each aclay In mydwg.layers If aclay.name = "table" Then Exit For End If Next mydwg.activelayer=aclay
|