The Event keyword, of course, specifies that the declaration??™s identifier (InvalidSupplierID) is
an event, and should be managed by VBA??™s class module hosting mechanism.
1069
Object-Oriented Programming with VBA 32
You may recall that I??™ve asserted that class modules were special in a number of regards. Events are
clearly one of the special characteristics of VBA class modules.
A quick look through the Object Browser at the class module (see Figure 32-13) shows that the
class??™s interface does, indeed, include the InvalidSupplierID event.
FIGURE 32-13
The InvalidSupplierID event appears in the Object Browser.
You??™ll notice a couple other events (InsufficientStockAvailable and ProductSold) in
the Product class module. We??™ve added the other events in exactly the same manner as the
InvalidSupplierID event. An event declaration is all that is required to add an event to a
class??™s interface. The class module never even has to trigger an event shown in the Object Browser.
Raising events
It should be obvious that an event that is never invoked by a class module??™s code isn??™t much use to
anybody.
Pages:
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011