Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default can I make a general object event procedure?

Is there a way to make event procedures generic? For example, if I create
and populate a list or combo box via code, can I pass the address of the
created box to a _change() procedure?

wazooli
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default can I make a general object event procedure?

Not generally. You can make an create a class and assign that class to
multiple objects, then define you events in that class.

See John Walkenbach's site for an example.
http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine

Written for a userform and commandbuttons, the approach will work for any
activeX control and can be for a userform or a worksheet.

--
Regards,
Tom Ogilvy


"Wazooli" wrote in message
...
Is there a way to make event procedures generic? For example, if I create
and populate a list or combo box via code, can I pass the address of the
created box to a _change() procedure?

wazooli



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default can I make a general object event procedure?

Yeah - he talks about it in his book. I will muck about with this. Don't be
surprised if i am back here tomorrow with questions.

"Tom Ogilvy" wrote:

Not generally. You can make an create a class and assign that class to
multiple objects, then define you events in that class.

See John Walkenbach's site for an example.
http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine

Written for a userform and commandbuttons, the approach will work for any
activeX control and can be for a userform or a worksheet.

--
Regards,
Tom Ogilvy


"Wazooli" wrote in message
...
Is there a way to make event procedures generic? For example, if I create
and populate a list or combo box via code, can I pass the address of the
created box to a _change() procedure?

wazooli




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default can I make a general object event procedure?

Wazooli,
Not sure if this is what you mean, but you can pass the object (or rather a
pointer to it ?) to a sub/function.

Private Function a_change(MyObject as Object) as long
'Decide what to do based on the type of object
If MyObject Is ComboBox Then.....


You could call this from any objects' event procedure
RetVal=a_change(ThisObject)

NickHk

"Wazooli" wrote in message
...
Is there a way to make event procedures generic? For example, if I create
and populate a list or combo box via code, can I pass the address of the
created box to a _change() procedure?

wazooli



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet/General Procedure problem [email protected] Excel Discussion (Misc queries) 2 June 29th 06 02:55 PM
Event Procedure Paul Johnson[_2_] Excel Programming 1 February 2nd 05 01:29 PM
Event Procedure again Paul Johnson[_2_] Excel Programming 1 February 2nd 05 01:28 PM
General Coding Procedure Question CB Hamlyn Excel Programming 3 March 2nd 04 04:55 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 04:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"