Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default A way refer to a control itself in an event handler

Hi all,

I have 60 controls on a form, and every control will handle an event in the
same way, so I decide to abstract the process into a sub and make the sub
call with corresponding control. If I can refer to the control itself in its
event handler then the calling process will be same across all controls
handlers.
Could you tell me a way to refer to a form's control itself in one of its
event handler , for example,

Private Sub txtEI3_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
' here I hope to refer to the control txtEI3 in a generic way like Me because
'there will be universal sub call using the control as parameter like
' FillDate Thiscontrol
End Sub


Clara
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default A way refer to a control itself in an event handler

You will need to this with a Class.
Plenty of examples available.

RBS

"clara" wrote in message
...
Hi all,

I have 60 controls on a form, and every control will handle an event in
the
same way, so I decide to abstract the process into a sub and make the sub
call with corresponding control. If I can refer to the control itself in
its
event handler then the calling process will be same across all controls
handlers.
Could you tell me a way to refer to a form's control itself in one of its
event handler , for example,

Private Sub txtEI3_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
' here I hope to refer to the control txtEI3 in a generic way like Me
because
'there will be universal sub call using the control as parameter like
' FillDate Thiscontrol
End Sub


Clara
thank you so much for your help


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
Event handler VBA Noob[_4_] Excel Programming 4 April 26th 06 03:49 PM
Autoshape event handler? [email protected] Excel Programming 7 February 23rd 06 10:12 PM
Global event handler?? [email protected] Excel Programming 1 October 23rd 04 05:31 PM
where is the workbook_open event handler??? Steff_DK[_10_] Excel Programming 2 April 25th 04 02:43 PM
different IDispatch in event handler Dirk[_2_] Excel Programming 0 January 23rd 04 11:04 PM


All times are GMT +1. The time now is 05:05 PM.

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"