以前有人使用过这个功能吗?我认为这可能是一个强大的东西。我在开发文档中找到了它。
Public with events ACADApp作为AcadApplication与应用程序事件示例一起使用
- 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.16")
- End Sub
- Private Sub ACADApp_[color=#ffffff]EndOpen[/color](ByVal FileName As String)
- ' This example intercepts an Application [color=#ffffff]EndOpen[/color] 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
这太棒了!问题是,就像它在上面的过程中所说的那样,你必须先运行它,然后内窥镜才能工作。我不想手动运行此操作。有人有什么想法吗?谢谢大R |