MACRO LIBRARY

Drawing sheet change event nofication example

Free public access. No account or subscription required.

Files

Drawing sheet change event notification example

Code

Module: mMain

'Demonstrates how to listen for pre and post sheet activation
    
'Precondition: drawing is open
'Results: message box is displayed before and after sheet is changed
    
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
    
Dim listener As New clsListener
    
Sub main()
    listener.connect
End Sub

Class: clsListener

Dim swApp As SldWorks.SldWorks
Dim WithEvents swDraw As SldWorks.DrawingDoc
    
Sub connect()
    Set swApp = Application.SldWorks
    Set swDraw = swApp.ActiveDoc
End Sub
    
Private Function swDraw_ActivateSheetPostNotify(ByVal SheetName As String) As Long
    swApp.SendMsgToUser SheetName & " is now activated."
End Function
    
Private Function swDraw_ActivateSheetPreNotify(ByVal SheetName As String) As Long
    swApp.SendMsgToUser SheetName & " will now activate."
End Function