Sub textadd()
Dim objDbx As AxDbDocument Dim objStyle(0) As Object If Left(Version, 2) = "15" Then Call AutoRegFile("C:\Program Files\AutoCAD 2002\axdb15.tlb") Set objDbx = CreateObject("ObjectDBX.AxDbDocument.1") ElseIf Left(Version, 2) = "16" Then Set objDbx = CreateObject("ObjectDBX.AxDbDocument.16") End If
'。。。。。。。。。。。。。。。。。。。。。。。。。。。
End Sub
Function AutoRegFile(FileName As String) Dim reged As Boolean Dim RegFile1 As String Dim RegFile2 As String Dim BeReg As String Dim RetVal BeReg = Dir(FileName) If BeReg <> "" Then RegFile1 = Environ("windir") & "\system\regsvr32.exe " RegFile2 = Environ("windir") & "\system32\regsvr32.exe " If Dir(RegFile1) <> "" Or Dir(RegFile2) <> "" Then If Dir(RegFile1) <> "" Then RegFile1 = RegFile1 & "/s" & " " & BeReg RetVal = Shell(RegFile1, 1) Else RegFile2 = RegFile2 & "/s" & " " & BeReg RetVal = Shell(RegFile2, 1) End If Else MsgBox "找不到regsvr32.exe文件,你可能无法使用本软件!", vbCritical, "无法自动注册控件" End If Else MsgBox "找不到控件文件!", vbCritical, "无法自动注册控件" End If End Function
每次执行到黑体部分就报错,(cad2002版)
并且已经引用了ObjectDBX.1
为何?我在cad2004版下已经可以用了
|