Class Modüleye Prosödür Ekleme

Katılım
17 Ağustos 2004
Mesajlar
222
Excel Vers. ve Dili
Ofiste Excel 2000 Türkçe
Evde Excel 2003 Türkçe
Merhabalar
Aşağıdaki kodlardaki Class1 modülüne TextBox_Exit prosüdürünü eklemeye çalıştım ama başaramadım.Eklemek için ne yapabiliriz?İyiçalışmalar.
Kod:
'CalssModüle 
Public WithEvents txt As MSForms.TextBox 

Private Sub txt_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) 
    Dim Dec 
    
    Dec = "." 
    
    If (KeyAscii < 44 Or KeyAscii > 57) And _ 
       (Not KeyAscii = Asc(Dec) Or InStr(1, txt, Dec) > 0) Then 
            KeyAscii = 0 
    ElseIf InStr(1, txt, Dec) And Len(txt) - InStr(1, txt, Dec) > 1 Then 
        KeyAscii = 0 
    
    End If 
txt.BackColor = &H80000005 

End Sub 


Private Sub txt_Change() 
    
    Dim p As Control, l As Control 
    
    Set l = frm.Controls("L" & Right(txt.Name, Len(txt.Name) - 7)) 
    Set p = frm.Controls("P" & Right(txt.Name, Len(txt.Name) - 7)) 

    txt = Replace(txt, ",", ".") 
    p = txt 
    p = Replace(p, ".", ",") 
    l = ParaCevir(p) 
  

frm.P43 = Format(Val(frm.TextBox1.Value) + Val(frm.TextBox2.Value) + Val(frm.TextBox3.Value) + Val(frm.TextBox4.Value) + Val(frm.TextBox5.Value) + Val(frm.TextBox6.Value) + Val(frm.TextBox7.Value) + Val(frm.TextBox8.Value) + Val(frm.TextBox9.Value) + Val(frm.TextBox10.Value) _ 
+ Val(frm.TextBox11.Value) + Val(frm.TextBox12.Value) + Val(frm.TextBox13.Value) + Val(frm.TextBox14.Value) + Val(frm.TextBox15.Value) + Val(frm.TextBox16.Value) + Val(frm.TextBox17.Value) + Val(frm.TextBox18.Value) + Val(frm.TextBox19.Value) + Val(frm.TextBox20.Value) + Val(frm.TextBox21.Value) + Val(frm.TextBox22.Value) + Val(frm.TextBox23.Value) + Val(frm.TextBox24.Value) + Val(frm.TextBox25.Value) + Val(frm.TextBox26.Value) + Val(frm.TextBox27.Value) + Val(frm.TextBox28.Value) + Val(frm.TextBox29.Value) + Val(frm.TextBox30.Value) + Val(frm.TextBox31.Value) + Val(frm.TextBox32.Value) + Val(frm.TextBox33.Value) + Val(frm.TextBox34.Value) + Val(frm.TextBox35.Value) + Val(frm.TextBox36.Value) + Val(frm.TextBox37.Value) + Val(frm.TextBox38.Value) + Val(frm.TextBox39.Value) + Val(frm.TextBox40.Value) + Val(frm.TextBox41.Value) + Val(frm.TextBox42.Value), "0.00") 

frm.L43.Caption = frm.mno.Value & " NOLU MAKBUZ TOPLAMI:" & ParaCevir(frm.P43.Value) 
frm.ListBox2.Value = "" 

End Sub 
'   BOÞ MODÜL 
Global frm As UserForm 
Global txtler() As New Class1 
'UF 
Private Sub UserForm_Initialize() 
Set frm = Me

Dim kontrol As Control, i As Integer
i = 1
For Each kontrol In Me.Controls
If Left(kontrol.Name, 5) = "Frame" Then GoTo devam
  If Left(kontrol.Name, 7) = "TextBox" Then
    ReDim Preserve txtler(i)
    Set txtler(i).txt = kontrol
    i = i + 1
  End If
If LCase(Left(kontrol.Name, 1)) = "g" And kontrol = Empty Then _
Controls("TextBox" & Right(kontrol.Name, Len(kontrol.Name) - 1)).Enabled = False
devam:
Next
End Sub
Amacım
TextBox1 = Format(Val(TextBox1.Value), "0.00") YTL formatını bütün TextBoxlara verebilmek.
 
Üst