Thread: Event priority
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
anonymousA anonymousA is offline
external usenet poster
 
Posts: 32
Default Event priority

Hi,

Does anybody know about events's priority ?.

For instance, in the same workbook, three events procedures triggered by
the same event: a sheet activation.

in the sheet module of Sheet1

Private Sub Worksheet_Activate()
MsgBox "triggered by sheet module"
End Sub

in the Thisworkbook module

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MsgBox "triggered by Thisworkbook module"
End Sub

in a class module named Class1 with the variable Appl declared in the
class module as Public WithEvents Appl As Application and an instance
of the class module that has been previously created in a standard module

Private Sub Appl_WorkbookActivate(ByVal Wb As Workbook)
MsgBox "triggered by Class module"
End Sub


Doing so, when Sheet1 is activated, the 1st message is the one of the
sheet module, the 2nd the Thisworkbook module one, the 3rd the class
module one, which means that there's some kind of priority in the
cascade of the events procedures .

Is it possible to break this priority and make one of my choice , and if
so , how to do it ? I don't want to use the instruction
Application.ontime in order to slow down the procedures triggered by the
events. I know I could fix it this way, but I 'd like to know if there's
an other way that is not a workaround.

Thanks.