Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
code asking for password
Hi,
I have a workbook with several sheets, and you navigate by buttons t the different sheets. One sheet is containing "secret information", not for all to see. How to write the code to get a inputbox when you click that button fo the first time saying,"choose password", and the second time and after inputbox saying "Enter password" to get access to that sheet. Any ideas? //Thoma -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
code asking for password
This wont stop access to a sheet but if you reference a hidden sheet i
you code to open the shet when the password input is true you should b ok, you will see that i have commented out some code what this does i reference a sheet called "hidden" and record the wrong entries tha have been made in the input box, if you want to use this just remov the apostrophies. The last line before end sub closes and saves th active workbook. You could place this code in the open worksheet_even so when the sheet is attempted to be opened it displays the messag box, but if they get the password wrong 3 times it closes and saves th whole program. t1 would be your list of valid passwords but you coul reference a named list. Sub msg() ' ' msg Macro ' Macro recorded 22/04/04 by Kellogg ' ' Keyboard Shortcut: Ctrl+Shift+M Dim t1 As String Dim I1 As Integer Dim I2 As Integer I1 = MsgBox("continue?", 292, "Choose Password") If I1 = 6 Then For I2 = 1 To 3 t1 = InputBox("name", "input", "") If t1 = "simon" Or t1 = "mark" Then ActiveCell = t1 Exit Sub ' Else 'Worksheets("hidden").Visible = True 'Worksheets("hidden").Select 'ActiveSheet.Range("a2").Select 'Selection.Insert Shift:=xlDown 'Selection = t1 'Worksheets("hidden").Visible = False End If Next 'I2 MsgBox "Please try again " & Chr(13) & "Entry not recognised " t1 ActiveWorkbook.Close savechanges:=False End If End Sub HTH Simo -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
code asking for password
Hi, and Thanks!!
I have put the code in a module, taken away the apostrophs, and it al works fine, until I type the password. I want to go to get access and automatically jump to the sheet name hidden. Now, I stay put in the same sheet as I have placed the "accessbutton". What have I missed here? //Thoma -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
code asking for password
Hi,
well im no programmer, i just created that code because i wante capture wrong inputs......your best bet is to record what you want t do and then fidle with the code afterwards.....you will find that yo wont get a great deal of response if you dont supply the code you working on with your question as the people who really do know wha they are talking about will be able to modify what you're using an understand what you're trying to do! Simo -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Put Password Protection in Code | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
password protect vba code | Excel Discussion (Misc queries) | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming | |||
PASSWORD PROMPTING CODE | Excel Programming |