open打开图形,没有打开,新手弱弱的问,在线等ing!
本帖最后由 作者 于 2005-7-12 17:15:37 编辑 <br /><br /> <P>Private Sub Form_Load()</P><P>Dim acadapp As Object '建立Application对象<BR>Dim acaddoc As Object '建立Document对象<BR>Dim mospace As Object '建立Model Space 对象<BR>On Error Resume Next</P>
<P>Set acadapp = GetObject(, "autocad.application") '若AutoCad已启动 , 则直接得到</P>
<P>If Err Then<BR> Err.Clear<BR> Set acadapp = CreateObject("autocad.application") '若AutoCad未启动,则运行它<BR> If Err Then<BR> MsgBox Err.Description<BR> Exit Sub<BR> End If<BR>End If</P>
<P>acadapp.Visible = True '使AutoCad可见<BR>Set acaddoc = acadapp.ActiveDocument '设acaddoc为当前图形文件<BR>Set mospace = acaddoc.ModelSpace '设mospace为当前图形文件的模型空间</P>
<P>Dim dwgname As String<BR>dwgname = "D:\课题\新疆油田\石南21电子文档归档\工艺\DL222加0\DL122加5\DWG22加5.dwg"<BR>If Dir(dwgname) <> "" Then<BR> acaddoc.Open dwgname '打开一个CAD文件<BR>Else<BR> MsgBox "File " & dwgname & " does not exist."</P>
<P>End If</P>
<P>End Sub</P>
<P>请各位大侠帮忙!小弟感激不尽!</P>
<P>我用的是AutoCAD2005 操作系统是简体中文XP</P>
<P><BR> </P> End Sub前少个end if <P>不好意思,拷贝的时候掉了。</P>
<P>我现在修改过来还是不行啊!</P>
<P>请再指点!</P>
<P>静侯!</P> <P> set objDoc = ACadApp.Documents.Open("c:\1.dwg")<BR></P> lzh741206发表于2005-7-12 20:13:00static/image/common/back.gif
set objDoc = ACadApp.Documents.Open(\"c:\1.dwg\")
多谢<EM>lzh741206斑竹的指点,小弟 的问题已经解决!!!</EM><BR>
页:
[1]