请教各位高手
<P>在excel 中aba编辑器先设置好:工具--引用--autocad 2000类型库后</P><P>在excel中定义了一个宏:</P>
<P>Public Sub drawautocadline()<BR>Dim autocadapplication As AutoCAD.acadApplication<BR>Dim startline(0 To 2) As Double<BR>Dim endline(0 To 2) As Double<BR>Set autocadapplication = CreateObject("autocad.acadapplication")<BR>startline(0) = Cells(2, 2).Value<BR>startline(1) = Cells(3, 2).Value<BR>endline(0) = Cells(2, 3).Value<BR>endline(1) = Cells(3, 3).Value<BR>autocadapplication.ActiveDocument.ModelSpace.AddLine startline, endline<BR>End Sub</P>
<P>运行时,弹出对话框,说activex不能创建部件对象,</P>
<P>将以上两处的autocad.acadapplication改为autocad.application也不行</P>
<P>不知什么原因,谢谢!<BR></P>
reply
Public Sub drawautocadline()<BR> Dim autocadapplication As AutoCAD.acadApplication<BR> Dim startline(0 To 2) As Double<BR> Dim endline(0 To 2) As Double<BR> Set autocadapplication = CreateObject("<FONT color=#ff3300>autocad.application</FONT>") '还可以具体指定版本号如autocad.application.16<BR> startline(0) = Cells(2, 2).Value<BR> startline(1) = Cells(3, 2).Value<BR> endline(0) = Cells(2, 3).Value<BR> endline(1) = Cells(3, 3).Value<BR> autocadapplication.ActiveDocument.ModelSpace.AddLine startline, endline<BR> autocadapplication.Documents.Item (0)<BR> autocadapplication.Visible = True<BR>End Sub<BR> <P>非常感谢王版!</P><P> </P>
页:
[1]