Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put Password Protection in Code Connie Excel Discussion (Misc queries) 3 October 25th 06 08:06 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
password protect vba code greg Excel Discussion (Misc queries) 3 December 8th 04 04:03 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM
PASSWORD PROMPTING CODE Jay Dean Excel Programming 3 September 28th 03 05:09 PM


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"