View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Michel S. Michel S. is offline
external usenet poster
 
Posts: 33
Default XL2003: Is it possible to sink a form's events in a class module ?

Thanks for your reply..

Not sure why you'd need to sink such an event in a class module


I made a class module which is using a set of controls (ListBox,
cmdButtons, etc..) to form a "generic-show-sort-and-pic" controls set.

This set of controls may appear on different forms. In other words,
the controls-set is generic, but not the form it is on.

Behind these controls are procedures needing sometimes to interact with
the form they are on. An obvious example is the "Close" button which
closes the form after some internal housekeeping. Another example is
the listbox "dblClick" event which needs to hide the form at some
point.

Since the forms properties and methods aren't all availiable in a class
module, this makes it hard to do without duplicating code.

On the other side, clicking on the form's "X" should execute the same
code as the cmdClose_click event. If the QueryClose event can only be
sinked in the form module while the cmdClose_Click is processed in the
class module, you need to either duplicate the code or find a
"creative" way to use the same code for both.

Hope this clarify why I want to put all related code in the class
module.


Sorry if this seems basic, but I'm used to Access where you can pass a
form object to a class module and all its properties, methods and
events are availiable to the class module as any other object..

I have a hard time understanding why it is not the same in Excel..

MS