Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Replace password with *** in input box, xlVeryHidden

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Replace password with *** in input box, xlVeryHidden

this site should point you in right direction:

http://www.xcelfiles.com/API_09.html
--
jb


"John" wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Replace password with *** in input box, xlVeryHidden

Yep. You can not do this kind of thing with an inputbox.

But you could design your own form. There's a .passwordchar property for
textboxes that you could change to asterisk.

John wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Replace password with *** in input box, xlVeryHidden

Thank you Dave.

Do you mean: Make a a new Custom UserForm in VBA, and then insert a textbox
from the tools menue. Then set the property of this inserted textbox to xxx?
Or do I develop a form in "Excel mode". (I'm not an expert of VBA yet...)
--
Thanks
John


"Dave Peterson" wrote:

Yep. You can not do this kind of thing with an inputbox.

But you could design your own form. There's a .passwordchar property for
textboxes that you could change to asterisk.

John wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Replace password with *** in input box, xlVeryHidden

If you want to design your own userform:

Debra Dalgleish shares some tips:
http://contextures.com/xlUserForm01.html

Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en...FormsPartI.asp
Part II
http://msdn.microsoft.com/library/en...ormsPartII.asp

You can change properties within the VBE (manually) or you could use code:

Option Explicit
Private Sub UserForm_Initialize()
Me.TextBox1.PasswordChar = "*"
End Sub

John wrote:

Thank you Dave.

Do you mean: Make a a new Custom UserForm in VBA, and then insert a textbox
from the tools menue. Then set the property of this inserted textbox to xxx?
Or do I develop a form in "Excel mode". (I'm not an expert of VBA yet...)
--
Thanks
John

"Dave Peterson" wrote:

Yep. You can not do this kind of thing with an inputbox.

But you could design your own form. There's a .passwordchar property for
textboxes that you could change to asterisk.

John wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Replace password with *** in input box, xlVeryHidden

Here is the end result for the un-hide operation:

'In the sheet where I have the button to call the UserForm:
Private Sub CommandButton1_Click()
Password.Show
End Sub

'The UserForm Cancel button:
Private Sub CancelButton_Click()
Unload Me
End Sub

'The UserForm OK button:
Private Sub OKButton_Click()
If TextBox1.Text < "secret" Then
MsgBox "Invalid Password"
Exit Sub
ElseIf TextBox1.Text = "secret" Then
Worksheets("Sheet2").Visible = True
Worksheets("Sheet1").Visible = True
Worksheets("Sheet1").Activate
Unload Password
End If
End Sub

The UserForm has a TextBox with TextBoxCharter set to "*", and the form is
called "Password"
--

John


"Dave Peterson" wrote:

If you want to design your own userform:

Debra Dalgleish shares some tips:
http://contextures.com/xlUserForm01.html

Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en...FormsPartI.asp
Part II
http://msdn.microsoft.com/library/en...ormsPartII.asp

You can change properties within the VBE (manually) or you could use code:

Option Explicit
Private Sub UserForm_Initialize()
Me.TextBox1.PasswordChar = "*"
End Sub

John wrote:

Thank you Dave.

Do you mean: Make a a new Custom UserForm in VBA, and then insert a textbox
from the tools menue. Then set the property of this inserted textbox to xxx?
Or do I develop a form in "Excel mode". (I'm not an expert of VBA yet...)
--
Thanks
John

"Dave Peterson" wrote:

Yep. You can not do this kind of thing with an inputbox.

But you could design your own form. There's a .passwordchar property for
textboxes that you could change to asterisk.

John wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Replace password with *** in input box, xlVeryHidden

Make sure you protect your project, too.

Inside the VBE:
Tools|VBAProject Properties|Protection tab

It's not 100%, but will keep most people from viewing your code.

John_J wrote:

Here is the end result for the un-hide operation:

'In the sheet where I have the button to call the UserForm:
Private Sub CommandButton1_Click()
Password.Show
End Sub

'The UserForm Cancel button:
Private Sub CancelButton_Click()
Unload Me
End Sub

'The UserForm OK button:
Private Sub OKButton_Click()
If TextBox1.Text < "secret" Then
MsgBox "Invalid Password"
Exit Sub
ElseIf TextBox1.Text = "secret" Then
Worksheets("Sheet2").Visible = True
Worksheets("Sheet1").Visible = True
Worksheets("Sheet1").Activate
Unload Password
End If
End Sub

The UserForm has a TextBox with TextBoxCharter set to "*", and the form is
called "Password"
--

John

"Dave Peterson" wrote:

If you want to design your own userform:

Debra Dalgleish shares some tips:
http://contextures.com/xlUserForm01.html

Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en...FormsPartI.asp
Part II
http://msdn.microsoft.com/library/en...ormsPartII.asp

You can change properties within the VBE (manually) or you could use code:

Option Explicit
Private Sub UserForm_Initialize()
Me.TextBox1.PasswordChar = "*"
End Sub

John wrote:

Thank you Dave.

Do you mean: Make a a new Custom UserForm in VBA, and then insert a textbox
from the tools menue. Then set the property of this inserted textbox to xxx?
Or do I develop a form in "Excel mode". (I'm not an expert of VBA yet...)
--
Thanks
John

"Dave Peterson" wrote:

Yep. You can not do this kind of thing with an inputbox.

But you could design your own form. There's a .passwordchar property for
textboxes that you could change to asterisk.

John wrote:

Hi,
The following code works fine but the password "secret" is visible as I
type. How can I hide it? Can I hide it by putting a label or another box on
top of the password input box? I believe it is not possible to hide charters
inside an input box...

Private Sub CommandButton1_Click()
pwd = "secret"
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet")
Select Case i_pwd
Case pwd
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet2").Activate
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End Sub
--
Thanks
John

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
Xlveryhidden K1KKKA Excel Discussion (Misc queries) 9 October 6th 07 04:19 AM
opposite of XLVeryhidden!! roshinpp_77[_5_] Excel Programming 4 June 5th 06 12:54 PM
XLVERYHIDDEN Sunil Patel Excel Programming 1 July 13th 05 10:41 PM
xlVeryHidden Resolution kevin Excel Programming 1 June 2nd 04 01:08 AM
Doing something wrong - xlVeryHidden Kevin Excel Programming 6 May 31st 04 12:22 AM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"