本帖最后由 作者 于 2008-5-3 12:47:24 编辑
Public AcadApp As Object Private Sub Form_Load() On Error Resume Next Set AcadApp = GetObject(, "AutoCAD.Application") If Err Then Err.Clear Set AcadApp = CreateObject("AutoCAD.Application") If Err Then MsgBox ("不能运行AutoCAD, 请检查是否安装了AutoCAD") Exit Sub End If End If AcadApp.Visible = True End sub Private Sub CommandButton1_Click() Dim blockRefObj As Object Dim Pnt(0 To 2) As Double Pnt(0) = 2#: Pnt(1) = 2#: Pnt(2) = 0# Set blockRefObj = AcadApp.Activedocument.ModelSpace.InsertBlock(Pnt,"D:\5w.dwg",1#, 1#, 1#, 0) blockRefObj.Explode blockRefObj.Update End Sub
西北凡人: http://www.abofanyi.com/blog |