1. Formulario de login.
2. Formulario de Registro.
3. Seguidamente vamos a crear el codigo del formulario 1
Private Sub CommandButton1_Click()
Dim clave As String * 5
clave = "STEVE"
If UCase$(Trim$(TextBox2.Text)) = clave Then
Unload Me
UserForm3.Show
Exit Sub
Else
MsgBox "contrasena incorrecta", vbInformation, "seguridad"
End If
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub TextBox1_Change()
If TextBox1.Text <> "" And TextBox2 <> "" Then
CommandButton1.Enabled = True
Else
CommandButton1.Enabled = False
End If
End Sub
Private Sub TextBox2_Change()
If TextBox2.Text <> "" And TextBox2 <> "" Then
CommandButton1.Enabled = True
Else
CommandButton1.Enabled = False
End If
End Sub
4. Hacemos el codigo para el formulario 2.
Private Sub CommandButton2_Click()
End
End Sub
Private Sub TextBox1_Change()
Range("a1").Select
ActiveCell.FormulaR1C1 = TextBox1
End Sub
Private Sub TextBox2_Change()
Range("b1").Select
ActiveCell.FormulaR1C1 = TextBox2
End Sub
Private Sub TextBox3_Change()
Range("c1").Select
ActiveCell.FormulaR1C1 = TextBox3
End Sub
Private Sub TextBox4_Change()
Range("d1").Select
ActiveCell.FormulaR1C1 = TextBox4
End Sub
Private Sub TextBox5_Change()
Range("e1").Select
ActiveCell.FormulaR1C1 = TextBox5
End Sub
Es una forma basica de ingreso de datos, a partir de este codigos simples puedes generar programacion VBA. complejos.
No hay comentarios:
Publicar un comentario