PC Review


Reply
Thread Tools Rate Thread

Code to show/hide sheet to asterisk the password

 
 
Newman Emanouel
Guest
Posts: n/a
 
      10th Apr 2008
Hello all

I need some help with some code. I found the follwoing code on the web and
thank you to the author it works well, but there is a problem in that it
shows the password as you type it in, increasing the risk of people breaking
the code. Is there a way that the input in the password box can be asterisk
out and not shown as the user is typing it in

Const pWord = "password"

Sub HideSheets()
'Set worksheet to Very Hidden so that it can only be unhidden by a macro
Worksheets("Salary").Visible = xlSheetVeryHidden
End Sub

Sub ShowSheets()

'Prompt the user for a password and unhide the worksheet if correct
Select Case InputBox("Please enter the password to unhide the sheet", _
"Enter Password")

Case Is = pWord
With Worksheets("Salary")
.Visible = xlSheetVisible
.Activate
.Range("A1").Select
End With
Case Else
MsgBox "Sorry, that password is incorrect!", _
vbCritical + vbOKOnly, "You are not authorized!"
End Select
End Sub

Thanks

Regards

 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      10th Apr 2008
Hi,

Actually it can be done with a standard input box. Have a look at the code
here courtesy of Ivan Moala

http://www.xcelfiles.com/InPutBoxPwd.htm

Mike

"Jean-Yves TFELT" wrote:

> Hi Emanouel,
>
> Use a form with a textbox and set the textbox property PasswordChar to *
> This cannot be achieved with an inputbox.
>
> Regards
> Jean-Yves
>
>
> "Newman Emanouel" <(E-Mail Removed)> wrote in message
> news:75DDBF7A-13D5-473F-AC64-(E-Mail Removed)...
> > Hello all
> >
> > I need some help with some code. I found the follwoing code on the web and
> > thank you to the author it works well, but there is a problem in that it
> > shows the password as you type it in, increasing the risk of people
> > breaking
> > the code. Is there a way that the input in the password box can be
> > asterisk
> > out and not shown as the user is typing it in
> >
> > Const pWord = "password"
> >
> > Sub HideSheets()
> > 'Set worksheet to Very Hidden so that it can only be unhidden by a
> > macro
> > Worksheets("Salary").Visible = xlSheetVeryHidden
> > End Sub
> >
> > Sub ShowSheets()
> >
> > 'Prompt the user for a password and unhide the worksheet if correct
> > Select Case InputBox("Please enter the password to unhide the sheet", _
> > "Enter Password")
> >
> > Case Is = pWord
> > With Worksheets("Salary")
> > .Visible = xlSheetVisible
> > .Activate
> > .Range("A1").Select
> > End With
> > Case Else
> > MsgBox "Sorry, that password is incorrect!", _
> > vbCritical + vbOKOnly, "You are not authorized!"
> > End Select
> > End Sub
> >
> > Thanks
> >
> > Regards
> >

>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
show/hide sheet tabs in '07 ribbon Susan Microsoft Excel Programming 2 24th Aug 2009 05:21 PM
Name of the sheet - hide and show Lars, Denmark Microsoft Excel Misc 5 21st Jan 2009 10:08 PM
Re: How Do I Password Hide a Sheet Gert-Jan Microsoft Excel Programming 2 30th Dec 2006 05:42 PM
Re: How Do I Password Hide a Sheet Gord Dibben Microsoft Excel Programming 0 21st Dec 2006 11:59 PM
Show & Hide Shape in a Sheet Pete Csiszar Microsoft Excel Programming 3 15th Jan 2005 01:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 AM.