Public wbNamaPengguna As String
Private Sub Workbook_Open()
Application.Visible = False
FrmLogin.Show
Application.Visible = True
End Sub
maaf mas@Caton, untuk yg diatas diletakkan dimanaya
syc coab bagini tidak bs
Private Sub LbMasuk_Click()
Public wbNamaPengguna As String
Private Sub Workbook_Open()
Application.Visible = False
FrmLogin.Show
Application.Visible = True
End Sub
Set WsUserName = Sheets("User")
Set RgUserPas = WsUserName.Range("A3:A20")
Set c = RgUserPas.Find(TxtUsername.Value, LookIn:=xlValues, MatchCase:=False)
Password = c.Offset(0, 1).Value
Level = c.Offset(0, 2).Value
If TxtUsername.Value = "" Then
MsgBox " Masukkan UserName", vbCritical, "User Login"
Exit Sub
End If
If TxtPassword.Value = "" Then
MsgBox "Masukkan Password", vbCritical, "User Login"
Exit Sub
End If
If TxtPassword <> Password Then
MsgBox "Username atau password yang anda masukan salah", vbCritical, "User Login"
Exit Sub
Else
MsgBox "Anda berhasil log in", vbInformation, "User Login"
ThisWorkbook.wbNamaPengguna = Trim$(TxtUsername)
If Level = "Admin" Then
Sheets("User").Visible = xlSheetVisible
Sheets("Formulir").Visible = xlSheetVisible
Sheets("Tabungan").Visible = xlSheetVisible
Sheets("Kls").Visible = xlSheetVisible
ElseIf Level = "User" Then
Sheets("Tabungan").Visible = xlSheetVeryHidden
Sheets("Formulir").Visible = xlSheetVisible
End If
Unload Me
UserForm2.Show
End If
End Sub
Private Sub LbBatal_Click()
ThisWorkbook.Close
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Untuk menutup Form silakan klik tomblo CLOSE", vbCritical
End If
End Sub