zgjzgjkyo 发表于 2008-7-9 22:14:00

[求助]如果解决VB用二次开发的版本问题?

<p>Dim acadApp As AcadApplication<br/>Dim acadDoc As AcadDocument<br/>Sub ConnectToAcad()<br/>On Error Resume Next<br/>&nbsp; Set acadApp = GetObject(, "AutoCAD.Application")<br/>&nbsp; If Err Then<br/>&nbsp;&nbsp;&nbsp; Err.Clear<br/>&nbsp;&nbsp;&nbsp; Set acadApp = CreateObject("AutoCAD.Application")<br/>&nbsp;&nbsp;&nbsp; acadApp.Visible = True<br/>&nbsp;&nbsp;&nbsp; If Err Then MsgBox Err.Description<br/>&nbsp; End If<br/>&nbsp; Set acadDoc = acadApp.ActiveDocument<br/>End Sub</p><p><br/>Private Sub Command1_Click()<br/>Dim start1(2) As Double<br/>Dim end1(2) As Double</p><p>end1(0) = 100</p><p>Dim line As AcadLine</p><p>Call ConnectToAcad</p><p>Set line = acadDoc.ModelSpace.AddLine(start1, end1)</p><p>End Sub</p><p>上面的这样代码是没有问题可运行的,但版本只能限于我所在的版本(如2004版)</p><p>有朋友说</p><p>Dim acadApp As AcadApplication<br/>Dim acadDoc As AcadDocument</p><p>改为</p><p>Dim acadApp As Object<br/>Dim acadDoc As Object</p><p>问题是我一这样用就出错,为什么呢?</p><p></p><p>&nbsp;</p>
页: [1]
查看完整版本: [求助]如果解决VB用二次开发的版本问题?