MikeS
12-05-2006, 10:08 AM
Simply put, I want to have AutoCAD run a vba routine whenever a drawing is openned.
Thanks to some help from this site, I have a routine that works for CAD 2000, but I am getting error messages in 2007.
Here is the code I have that works in 2000:
In the ThisDrawing tab:
Dim Aok As Class1
Private Sub AcadDocument_Activate()
If Aok Is Nothing Then Set Aok = New Class1
If IsEmpty(ACADApp) Then Aok.AcadApplication_Events
End Sub
in the Class Modules tab:
Public WithEvents ACADApp As AcadApplication
Public Sub AcadApplication_Events()
Set ACADApp = GetObject(, "AutoCAD.Application")
End Sub
Private Sub ACADApp_EndOpen(ByVal filename As String)
RunMacro "AddaBlock.XrefUpdate"
End Sub
and in the modules tab..
Sub XrefUpdate()
..code...
End Sub
TIA for any help
Thanks to some help from this site, I have a routine that works for CAD 2000, but I am getting error messages in 2007.
Here is the code I have that works in 2000:
In the ThisDrawing tab:
Dim Aok As Class1
Private Sub AcadDocument_Activate()
If Aok Is Nothing Then Set Aok = New Class1
If IsEmpty(ACADApp) Then Aok.AcadApplication_Events
End Sub
in the Class Modules tab:
Public WithEvents ACADApp As AcadApplication
Public Sub AcadApplication_Events()
Set ACADApp = GetObject(, "AutoCAD.Application")
End Sub
Private Sub ACADApp_EndOpen(ByVal filename As String)
RunMacro "AddaBlock.XrefUpdate"
End Sub
and in the modules tab..
Sub XrefUpdate()
..code...
End Sub
TIA for any help