Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Option Explicit Private Sub AddNameButton_Click() 'This allows users to add their name to the list of users Dim strName As String Dim strPassword As String Dim Counter As Integer Dim Check As Boolean Me.Hide 'Display input box to captrue name and password strName = InputBox(Prompt:="Please Enter Your Name.", _ Title:="ENTER YOUR NAME", Default:="Your Name Here") strPassword = InputBox(Prompt:="Please enter your password.", _ Title:="ENTER YOUR Password", Default:="Your Password Here") 'If it doesn't have anything, then exit sub If strName = "Your Name here" Or strName = vbNullString Or strPassword = "Your Password Here" Or strPassword = vbNullString Then MsgBox ("Error, please try again") Exit Sub Else 'make the password lowercase - for some reason case does matter in this report strPassword = StrConv(strPassword, vbLowerCase) Me.Hide Counter = 1 Check = False Do Until Check = True If Sheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0) = "" Then Check = True 'Format cells as text, otherwise you could get errors Worksheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0).NumberFormat = "@" Worksheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0) = strName Worksheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 1).NumberFormat = "@" Worksheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 1) = strPassword 'Sort list alphabetically, to help people find their name Worksheets("Data Sheet").ListObjects("Table1").Sort.SortFields.Clea r Worksheets("Data Sheet").ListObjects("Table1").Sort.SortFields.Add _ Key:=Range("Table1[[#All],[Names]]"), SortOn:=xlSortOnValues, Order:= _ xlAscending, DataOption:=xlSortTextAsNumbers ActiveWorkbook.Worksheets("Data Sheet").ListObjects("Table1").Sort.Apply ActiveWorkbook.Save Else If Sheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0) = strName Then MsgBox ("Error - Your Name Is Already Enterer. Please Check Again.") Exit Sub End If End If Counter = Counter + 1 Loop End If Unload Me Call ShowPunchIn End Sub Private Sub Label1_Click() End Sub Private Sub PunchIn_Click() 'This is the sub to record the time when punching in. It records the data on the "Data Sheet" Sheet 'The "Data Sheet" sheet also has the usernames and passwords of the users Dim Counter As Double Dim Strp As String Dim Found As Boolean Dim strPassword As String Me.Hide strPassword = PasswordTextBox.Text strPassword = StrConv(strPassword, vbLowerCase) 'Find their Username on the List Counter = 0 Found = False Do Until Found = True Counter = Counter + 1 If Sheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0) = NameDropDown.Text Then Found = True End If 'Error if the name is not on the list If Sheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 0) = "" Then MsgBox ("Name is not in list. Please Select a name from the dropdown menu or add your name to the list.") Unload Me Call ShowPunchIn Exit Sub End If Loop 'Check to see if password matches If Sheets("Data Sheet").Range("Table1[[#Headers],[Names]]").Offset(Counter, 1) = strPassword Then Found = False Counter = 1 Do Until Found = True 'Enter in the time and save If Sheets("Data Sheet").Range("b2").Offset(Counter, 0) = "" Then Sheets("Data Sheet").Range("b2").Offset(Counter, 0).NumberFormat = "@" Sheets("Data Sheet").Range("b2").Offset(Counter, 0) = NameDropDown.Text Sheets("Data Sheet").Range("b2").Offset(Counter, 1) = Now Found = True Strp = "Punched in at " & Now MsgBox (Strp) ActiveWorkbook.Save Else 'If there is an error, then notify If Sheets("Data Sheet").Range("b2").Offset(Counter, 0) = NameDropDown.Text Then If Sheets("Data Sheet").Range("b2").Offset(Counter, 2) = "" Then MsgBox ("You May Have Not Clocked Out. Please Talk to Mr.Hemachandran to Fix the Error.") Found = True Unload Me Call ShowPunchIn Exit Sub End If End If End If Counter = Counter + 1 Loop Else: MsgBox ("Incorrect Password") End If Unload Me End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
InputBox doesn't have this functionality. you will need to make a userform with a text box on it and set the PasswordChar property of the text box to something like * isabelle Le 2014-11-27 01:36, Ramesh ML a écrit : How to hide password? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide a Password | Excel Programming | |||
hide column with password | Excel Discussion (Misc queries) | |||
how to hide raws and use password | Excel Discussion (Misc queries) | |||
How do I hide a worksheet in Excel and use a password to un-hide . | Excel Discussion (Misc queries) | |||
Excel password but cant hide the sheets before entering password | Excel Programming |