运行时错误‘429’,ACTIVEX部件不能创建对象。具体代码如下(环境vs2005):
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Public Class Form1
Dim AcadApp As AcadApplication
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call StartAutoCAD()
End Sub
Sub StartAutoCAD()
On Error Resume Next
AcadApp = GetObject(, "AcadApplication")
If Err.Number Then
MsgBox(Err.Number)
AcadApp = CreateObject("AcadApplication")
If Err.Number Then
Exit Sub
End If
End If
AcadApp.Visible = True
AppActivate(AcadApp.Caption) '显示AutoCAD界面
End Sub
有人遇到过吗?该如何解决?