Message 1 of 5
Why won't this initialize application event handlers?

Not applicable
05-29-2001
03:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In a class module (named: eventclass) I have the following:
'#####################################
Option Explicit
Public Sub AcadApp_SysVarChanged(ByVal SysvarName As String, ByVal newVal As
Variant)
Dim oldsf As Single
Dim newsf As Single
MsgBox "SysvarChanged event " & "Sysvar: " & SysvarName, vbOKOnly
oldsf = ThisDrawing.GetVariable("userr1")
Select Case SysvarName
Case Is = "Tilemode"
If newVal = 1 Then
newsf = MsgBox("New drawing scale factor(" & Format(oldsf,
"0,###.###") & "): ", _
vbOKOnly, "Tilemode changed")
Else
MsgBox "Tilemode turned off"
End If
End Select
End Sub
'#####################################
and in the ThisDrawing module I have:
'#####################################
Dim AppEvents As New EventClass
Public WithEvents AcadApp As AcadApplication
Private Sub InitializeAppEvents()
Set AppEvents.AcadApp = ThisDrawing.Application
End Sub
Public Sub VBA_ini()
ThisDrawing.Utility.Prompt vbCrLf & "VBA system initialized. "
InitializeAppEvents
End Sub
'#####################################
with VBA_ini being called from my s::startup function.
What am I missing here?
'#####################################
Option Explicit
Public Sub AcadApp_SysVarChanged(ByVal SysvarName As String, ByVal newVal As
Variant)
Dim oldsf As Single
Dim newsf As Single
MsgBox "SysvarChanged event " & "Sysvar: " & SysvarName, vbOKOnly
oldsf = ThisDrawing.GetVariable("userr1")
Select Case SysvarName
Case Is = "Tilemode"
If newVal = 1 Then
newsf = MsgBox("New drawing scale factor(" & Format(oldsf,
"0,###.###") & "): ", _
vbOKOnly, "Tilemode changed")
Else
MsgBox "Tilemode turned off"
End If
End Select
End Sub
'#####################################
and in the ThisDrawing module I have:
'#####################################
Dim AppEvents As New EventClass
Public WithEvents AcadApp As AcadApplication
Private Sub InitializeAppEvents()
Set AppEvents.AcadApp = ThisDrawing.Application
End Sub
Public Sub VBA_ini()
ThisDrawing.Utility.Prompt vbCrLf & "VBA system initialized. "
InitializeAppEvents
End Sub
'#####################################
with VBA_ini being called from my s::startup function.
What am I missing here?