在excel 中aba编辑器先设置好:工具--引用--AutoCAD 2000类型库后
在excel中定义了一个宏:
Public Sub drawautocadline() Dim autocadapplication As AutoCAD.acadApplication Dim startline(0 To 2) As Double Dim endline(0 To 2) As Double Set autocadapplication = CreateObject("autocad.acadapplication") startline(0) = Cells(2, 2).Value startline(1) = Cells(3, 2).Value endline(0) = Cells(2, 3).Value endline(1) = Cells(3, 3).Value autocadapplication.ActiveDocument.ModelSpace.AddLine startline, endline End Sub
运行时,弹出对话框,说activex不能创建部件对象,
将以上两处的autocad.acadapplication改为autocad.application也不行
不知什么原因,谢谢!
|