Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everyone. Can someone help me with this problem:
I have this code, where the macro asks the user to enter password, an if the password = t1 then it lets them continue in the file. If the try their password 3 times incorrectly then it closes. However a present if they enter no at "ready to continue?" it does nothing an still alllows the user access. I need to add a line in so that if they decide not to enter a username then it closes the worksheet. Thanks for all help. Code below: Sub Password() Dim t1 As String Dim I1 As Integer Dim I2 As Integer I1 = MsgBox("Ready to continue?", 292, "We need to check that you ar an authorised user!!") If I1 = 6 Then For I2 = 1 To 3 t1 = InputBox("name", "input", "") If t1 = "scott" Or t1 = "scott wilson" Then Worksheets("Last user").Visible = True Sheets("Last User").Select ActiveCell = t1 Worksheets("Last User").Visible = False Worksheets("Menu").Visible = True Sheets("Menu").Select Exit Sub Else Worksheets("Last User").Visible = True Worksheets("Last User").Select ActiveSheet.Range("a2").Select Selection.Insert Shift:=xlDown Selection = t1 Worksheets("Last User").Visible = False End If Next I2 MsgBox "Please try again " & Chr(13) & "Entry not recognised " & t1 ActiveWorkbook.Close savechanges:=False End If End Sub Thanks Scott -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
why do all excel worksheets/workbooks close when I close one? | Excel Discussion (Misc queries) | |||
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. | Excel Worksheet Functions | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel | |||
Open en close a workbook with password | Excel Programming |