|
-
Feb 23rd, 2004, 07:35 AM
#1
Thread Starter
New Member
OpenEvent
Hello, I'm trying to capture the events onOpen() and onNew() in an Autocad App.
I checked the VBA help and I got:
--------------------------------------------------------------------------------
Public WithEvents ACADApp As AcadApplication
---------------------------------------------------------------------------------
Sub Example_AcadApplication_Events()
Set ACADApp = GetObject(, "AutoCAD.Application")
End Sub
---------------------------------------------------------------------------------
Private Sub ACADApp_BeginOpen(FileName As String)
MsgBox "A drawing is about to be loaded from: " & FileName
End Sub
--------------------------------------------------------------------------------
And I put this in Class Modules in a class named Class1.
now I have a macro that is executed once at the begining...
I plugged this code at the end of that macro:
Dim Inst As New Class1
Inst.Example_AcadApplication_Events
But nothing happens when I open a file in Autocad!!
any help?
any suggestions for the "onNew()" event?
thanks allot
-
Feb 23rd, 2004, 10:06 AM
#2
Addicted Member
No experience with AutoCad macros, but a couple of ideas :-
Excel will not be able to trap these events, AFAIK for them to work you will need to have code written for these events in the files that are opened. This is how it works in MS Office.
What are you trying to do ? The GetObject method only makes a new (empty) instance of the application, then by definition you open an existing file or make a new one in code using Excel , assuming the application allows this link.
Regards
BrianB
-------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|