VB中activex部件不能创建对象
我是用VB对AUTOCAD进行二次开发,在工程,引用中把相关的东西给添加过了,但是还是显示不能创建对象,网上讲用一段代码放在文本中修改为 .bat后缀也试了,不行,在运行中注册也不行,有的讲要从新装系统?不知道到底是怎么了,代码如下Dim acadApp As Object
Dim PREFERENCE As Object
Dim acadDoc As Object
Dim PASPACE As Object
Dim MoSpace As Object
Dim lineObj As AcadLine
Dim circleobj As AcadCircle
Dim startPoint(0 To 2) As Double
Dim EndPoint(0 To 2) As Double
Private Sub Form_Load()
Pi = 3.1415926 '定义圆周率常数
' 打开CAD并设定相关参数
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
' 如果已打开CAD
If Err Then
Err.Clear
Set acadApp = GetObject(, "AutoCAD.Application")
'未打开CAD,则创建CAD文档
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
acadApp.Visible = True '可见
acadApp.Left = 0
acadApp.Top = 0
acadApp.Width = 600
acadApp.Height = 400
Set PREFERENCE = acadApp.PREFERENCE
Set acadDoc = acadApp.ActiveDocument
Set MoSpace = acadDoc.ModelSpace
Set PASPACE = acadDoc.PaperSpace
End Sub
运行出错!!!!提示activex部件不能创建对象