Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
RaiseEvent Problem
In my study of RaiseEvent, I have a Question.
I have 2 Textboxes in UserForm1: TextBox1, TextBox2 When I run, Event is fired only on TextBox2. TextBox1 does not fire Event. What is the problem?? my codes... ---(Class1 module)----- Private WithEvents mTx As MSForms.TextBox Public Event F1Pressed() Public Property Set Control(ByRef Ctl As MSForms.TextBox) Set mTx = Ctl End Property Private Sub mTx_KeyDown( _ ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) If Shift Then Exit Sub RaiseEvent F1Pressed End Sub --(UserForm1 module)--------- Private Col As VBA.Collection Private WithEvents myCls As Class1 Private Sub UserForm_Initialize() Dim Ctl As Control Set Col = New VBA.Collection For Each Ctl In Controls If TypeOf Ctl Is MSForms.TextBox Then Set myCls = New Class1 Set myCls.Control = Ctl Col.Add myCls End If Next End Sub Private Sub myCls_F1Pressed() MsgBox "F1 Clicked" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming | |||
RaiseEvent from a class contained in a 2nd class collection? | Excel Programming |