Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Xlveryhidden | Excel Discussion (Misc queries) | |||
opposite of XLVeryhidden!! | Excel Programming | |||
XLVERYHIDDEN | Excel Programming | |||
xlVeryHidden Resolution | Excel Programming | |||
Doing something wrong - xlVeryHidden | Excel Programming |