Event priority

A

anonymousA

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.
 
B

Bob Phillips

I think you are stuck with the priority as Excel sees it. OnTime is a
standard way of getting control of the order, or to provide 'After' events.

So, as far as I am aware, Ontime is the way.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
A

anonymousA

Thanks for your answer and too bad there's no solution.

Regards

Bob Phillips a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top