- 20 Jun 2022 às 14:49
#71397
Pessoal ,
Boa tarde
Estou criando uma macro de login e senha , porém esta dando erro de argumentação e não onde estou falhando nos argumentos
Private Sub cmdEntrar_Click() - Aqui esta depurando o erro
If txtlogin = "" Then
MsgBox "Digite o nome do usuário !"
Exit Sub
txtlogin.SetFocus
Else
If txtsenha = "" Then
MsgBox "Digite a senha do usuário !"
Exit Sub
txtsenha.SetFocus
End If
col = 1
lin = 2
While (User.Cells(lin, col) <> txtlogin)
lin = lin + 1
If lin > 50 Then
MsgBox "Usuário não esta cadastrado"
Exit Sub
End If
Wend
Dim senha As String
col = 2
senha = User.Cells(lin, col).Value
If txtsenha <> senha Then
MsgBox "A senha não confere !!"
Exit Sub
Else
MsgBox "Seja Bem Vindo " & txtlogin
lin = 2
col = 1
While (Log.Cells(lin, col) <> "")
lin = lin + 1
Wend
Log.Cells(lin, 1) = txtlogin.Value
Log.Cells(lin, 2) = txtsenha.Value
Log.Cells(lin, 3) = Date
Motorista.Visible = xlSheetVisible
Sheets("Motorista").Activate
ActiveWindow.DisplayWorkbookTabs = False
Hide
End If
End Sub


Boa tarde
Estou criando uma macro de login e senha , porém esta dando erro de argumentação e não onde estou falhando nos argumentos
Private Sub cmdEntrar_Click() - Aqui esta depurando o erro
If txtlogin = "" Then
MsgBox "Digite o nome do usuário !"
Exit Sub
txtlogin.SetFocus
Else
If txtsenha = "" Then
MsgBox "Digite a senha do usuário !"
Exit Sub
txtsenha.SetFocus
End If
col = 1
lin = 2
While (User.Cells(lin, col) <> txtlogin)
lin = lin + 1
If lin > 50 Then
MsgBox "Usuário não esta cadastrado"
Exit Sub
End If
Wend
Dim senha As String
col = 2
senha = User.Cells(lin, col).Value
If txtsenha <> senha Then
MsgBox "A senha não confere !!"
Exit Sub
Else
MsgBox "Seja Bem Vindo " & txtlogin
lin = 2
col = 1
While (Log.Cells(lin, col) <> "")
lin = lin + 1
Wend
Log.Cells(lin, 1) = txtlogin.Value
Log.Cells(lin, 2) = txtsenha.Value
Log.Cells(lin, 3) = Date
Motorista.Visible = xlSheetVisible
Sheets("Motorista").Activate
ActiveWindow.DisplayWorkbookTabs = False
Hide
End If
End Sub

