Gruppe
Dialog
Problem
Wie kann ich den Text einer UserForm-Textbox in eine Variable einlesen und weiterverwerten? Die Eingabe in die Textbox soll begrenzt sein.
ClassModule: frmVariables
Private Sub txtVariables_Change()
Dim sVariable As String
Dim dVariable As Double
With txtVariables
If Not Right(.Text, 1) Like "[0-9,]" Then
.Text = Left(.Text, .TextLength - 1)
End If
If Len(.Text) = 5 Then
sVariable = .Text
dVariable = CDbl(.Text)
MsgBox _
"Text: " & sVariable & vbLf & _
"Wert: " & dVariable * 2
End If
End With
End Sub
Private Sub cmdContinue_Click()
Unload Me
End Sub
StandardModule: basMain
Sub CallForm()
frmVariables.Show
End Sub