Macro para ingresar usuario y contraseña y ver foto de usuario

Para dante

La segunda parte seria la foto en el formulario para ingresar

1 Respuesta

Respuesta
3

H o l a:

Te anexo el código para ingresar

Private Sub btn_Registrar_Click()
'Por.Dante Amor
    titulo = "Gestor de Inventarios"
    If txtUsuario = "" Then
        MsgBox "Captura el usuario", vbExclamation, titulo
        txtUsuario.SetFocus
        Exit Sub
    End If
    If txtPassword = "" Then
        MsgBox "Captura la contraseña", vbExclamation, titulo
        txtPassword.SetFocus
        Exit Sub
    End If
    Set b = Hoja6.Range("A:A").Find(txtUsuario, lookat:=xlWhole)
    If b Is Nothing Then
        MsgBox "El usuario '" & txtUsuario & "' no existe", vbExclamation, titulo
        txtUsuario.SetFocus
        Exit Sub
    End If
    If Hoja6.Cells(b.Row, "B") <> txtPassword Then
        MsgBox "La contraseña es incorrecta", vbExclamation, titulo
        txtPassword.SetFocus
        Exit Sub
    End If
    '
    'Registra en Logs
    u = Hoja8.Range("A" & Rows.Count).End(xlUp).Row + 1
    Hoja8.Cells(u, "A") = Now
    Hoja8.Cells(u, "B") = txtUsuario
    Hoja8.Cells(u, "C") = Hoja6.Cells(b.Row, "C")
    Unload Me
End Sub
'
Private Sub txtUsuario_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Set b = Hoja6.Range("A:A").Find(txtUsuario, lookat:=xlWhole)
    If Not b Is Nothing Then
        imagen = Hoja6.Cells(b.Row, "D")
        If imagen <> "" Then
            On Error Resume Next
            Image2.Picture = LoadPicture(imagen)
        End If
    End If
End Sub
'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas