我写了一个程序:
Dim acadapp As New AcadApplication '建立Application对象 Dim acaddoc As New AcadDocument '建立Document对象 On Error Resume Next
Set acadapp = GetObject(, "AutoCAD.application") '若AutoCad已启动 , 则直接得到 If Err Then Err.Clear Set acadapp = CreateObject("autocad.application") '若AutoCad未启动,则运行它 If Err Then MsgBox Err.Description Exit Function End If End If MsgBox "Now running " + acadapp.Name + " version " + acadapp.Version
acadapp.Visible = True Set acaddoc = acadapp.ActiveDocument '设acaddoc为当前图形文件
Dim dwgname As String dwgname = "F:\ElectroSign\updataDwg\dwg\jxf.dwg" If Dir(dwgname) <> "" Then acaddoc.Open(dwgname) '打开一个CAD文件 acadapp.Visible = True '使AutoCad可见 Else MsgBox "没有此文件" End If
jxf.dwg文件找得到,为什么AutoCad可见后,仍然是默认的Drawing1.dwg啊?
这样的话,我无法对jxf.dwg进行修改啊??
在此请教高手!:)