VB中创建AutoCAD对象错误

来源:百度知道 编辑:UC知道 时间:2024/05/22 17:14:44
在VB中
若已经打开AutoCAD应用程序(AutoCAD2004),获取对象没错
set test=GetObject(,"AutoCad.Application")
但是
set test=CreateObjects("AutoCad.Application")
执行这句会提示80040111自动化错误.
请问有谁碰到类似的问题解决了,不胜感激。
一样的错。

正常情况下都会碰到这种问题,办法是
on error resume next
set test=GetObject(,"AutoCad.Application")
If error.number<>0 then
set test=CreateObjects("AutoCad.Application")
endif

用set test=GetObject("AutoCad.Application") 创建对象试试