+ Reply to Thread
Results 1 to 2 of 2

Validação de De login e usuário vba

  1. #1
    Registered User
    Join Date
    05-28-2020
    Location
    brasil
    MS-Off Ver
    2016
    Posts
    8

    Validação de De login e usuário vba

    Boa noite amigos... Estou meio frustrado com um problema, depois de muito tentar, não consigo fazer com que o botão Entrar (valide o usurário) clicando nele ele nada faz.

    consigo executar a primeira e a segunda parte do script com sucesso, mais a terceira parte nada acontece

    segue o código*abaixo.*(Legenda : Form_Loguin*/ Text_Login e a Aba do Excel ficou com o nome de Login.)

    agradeço a ajuda


    Sub Entrar()

    * * * * *Usuario = Form_Loguin.Text_Login
    * * * * Senha = Form_Loguin.Text_Senha
    * * * *
    'primeira parte -verifica os capos vazios
    * * * *
    * * * * If Form_Loguin.Text_Login = "" Then
    * * * * MsgBox "Entre com o Nome de Usuário", vbInformation, "USUÁRIO"
    * * * *
    * * *Exit Sub
    * *
    End If
    * * * * If Form_Loguin.Text_Senha = "" Then
    * * * * MsgBox "Entre Com a Senha do Usuário", vbInformation, "SENHA"
    * *
    * * Exit Sub
    * *
    End If

    'Segunda parte - Verifica se é administador e se for entra

    * * If Form_Loguin.Text_Login = "ADMIN" And Form_Loguin.Text_Senha = "ADMIN" Then
    * * MsgBox "Bem vindo Administrador", vbOKOnly, "ACESSO LIBERADO"
    * *
    * * Sheets("Login").Select
    * *
    Exit Sub

    End If
    * *
    'Terceira parte - Verifica se o usuário e senha estão no banco de dados (daqui em diante, nada acontece)

    * * linha = 2
    * *
    * * Do Until Sheets("Login").Cells(linha, 1) = ""
    * *
    * * If Sheets("Login").Cells(linha, 1) = Form_Loguin.Text_Login And Sheets("Login").Cells(linha, 2) = Form_Loguin.Text_Senha Then
    * *
    * * MsgBox "Bem Vindo" & Usuario, vbOKOnly, "ACESSO LIBERADO"
    * *
    * * *Unload Form_Loguin
    * * Sheets("Home").Select
    * *
    Exit Sub
    *
    End If
    linha = linha + 1
    Loop

    End Sub
    Last edited by leegrj; 05-31-2020 at 09:30 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Validação de De login e usuário vba

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA Macro to capture the First Login & Last Logout with Total Login Hours Delivered
    By Yadavgiri in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-08-2020, 01:02 PM
  2. Need help in login vba code to unhide specific sheets depends on login info
    By AlaaEddin95 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2019, 08:19 PM
  3. Create login screen with multiple login id and password
    By anilpatni1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-01-2018, 10:14 AM
  4. Replies: 2
    Last Post: 09-28-2017, 03:49 PM
  5. Replies: 1
    Last Post: 04-30-2017, 08:26 PM
  6. Any excel formula to get first login and last login data
    By sandesh joshi in forum Excel General
    Replies: 5
    Last Post: 07-11-2014, 11:18 AM
  7. find the login user and saving /login the name
    By belkin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2008, 08:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1