[求助]如果解决VB用二次开发的版本问题?
<p>Dim acadApp As AcadApplication<br/>Dim acadDoc As AcadDocument<br/>Sub ConnectToAcad()<br/>On Error Resume Next<br/> Set acadApp = GetObject(, "AutoCAD.Application")<br/> If Err Then<br/> Err.Clear<br/> Set acadApp = CreateObject("AutoCAD.Application")<br/> acadApp.Visible = True<br/> If Err Then MsgBox Err.Description<br/> End If<br/> 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> </p>
页:
[1]