ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Macro Password Characters (https://www.excelbanter.com/excel-programming/432639-hide-macro-password-characters.html)

Morgimo

Hide Macro Password Characters
 
I have the following code:

If InputBox("To run update, please enter the password:") < "password" Then
Exit Sub

What is the code to get the password to display as ******** as they type?

Thanks,
Jacob

Per Jessen[_2_]

Hide Macro Password Characters
 
Hi Jacob

It can only be done in an userform.

Create an userform with a Textbox and two buttons ( OK/Cancel). Select
the Textbox and open the Properties window (F4) and find the
PasswordChar property and enter * in the filed next to it.

Hopes this helps.
....
Per

On 20 Aug., 02:04, Morgimo wrote:
I have the following code:

If InputBox("To run update, please enter the password:") < "password" Then
Exit Sub

What is the code to get the password to display as ******** as they type?

Thanks,
Jacob



Damian Carrillo[_3_]

Hide Macro Password Characters
 
Jacob,

A few years ago I found a solution for this dilemma on one of the many
Excel message boards So here it goes:

The inputbox is a native component and can't be modified insomuch as
you describe. However if you make your own form you can use a textbox
instead and set the textbox to have an inputmask. For the new form in
VB6 or newer you can set the passwordchar property to *

First in your code you have to replace:

YourPassword = InputBox("Please enter your password")

with

YourPassword = frmPass.Raise

Then in the new password form code:
--------------------------------------------------------------

Option Explicit
Dim strPassword As String

Private Sub cmdOkay_Click()
strPassword = txtPass.Value
Me.Hide
End Sub

Public Function Raise() As String
Me.Show vbModal
Raise = strPassword
End Function

--------------------------------------------------------------
Note that cmdOkay is the name of the Okay button on the password box,
txtPass is the name of the textbox you enter the password in and
frmPass is the name of the password form. Hope this helps you.


All times are GMT +1. The time now is 05:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com