请教大侠:Excelvba 打开CAD文件后没执行命令
请教大侠:我是用excelvba打开一个CAD文件,然后删除CAD里面的某个块。但往往是删除这个命令没有执行,是不是文件没有完全打开,就已经执行了删除命令呢,导致没有执行成功?那么应该怎样让删除命令顺利执行呢,我刚学习这个,在论坛也找不到相关资料,麻烦各位不吝赐教。
Call open……
Call DeleteBlock("A1") '此命令没执行
Public WithEvents ACADApp As AcadApplication ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
' This example intializes the public variable (ACADApp) which will be used
' to intercept AcadApplication Events
'
' The VBA WithEvents statement makes it possible to intercept an generic object
' with the events associated with that object.
'
' Before you will be able to trigger any of the AcadApplication events,
' you will first need to run this procedure.
' We could get the application from the ThisDocument object, but that would
' require having a drawing open, so we grab it from the system.
Set ACADApp = GetObject(, "AutoCAD.Application.19")
End Sub
Private Sub ACADApp_EndOpen(ByVal FileName As String)
' This example intercepts an Application EndOpen event.
'
' This event is triggered when AutoCAD finishes opening a drawing.
'
' To trigger this example event:
' 1) Make sure to run the example that initializes
' the public variable (named ACADApp) linked to this event.
'
' 2) Use AutoCAD to open an existing drawing and wait until the
' operation finishes
' Use the "FileName" variable to determine which drawing file is being opened
MsgBox "A drawing was just loaded from: " & FileName
End Sub
zzyong00 发表于 2015-5-25 22:03 static/image/common/back.gif
非常感谢大侠的回复,不过我刚接触这个,还是搞不明白应该怎么处理,能不能结合我的例子详细说明呢,谢谢!
是不是这样的呢?似乎通不过
Call open……
Call ACADApp_EndOpen(filename)
Call DeleteBlock("A1") OK,已经搞定,看了些教程拿来急用先了,哈哈,谢谢 zzyong00的指点
页:
[1]