Share via

Hide Password Prompt

Anonymous
2012-07-27T06:46:22+00:00

I am using the following code to restrice access to a hidden sheet, pending the correct password being entered. The problem I have is that the password

entered is visable on the screen. How do I block the password from being viewed when entered.

' Wages Macro

'Sub PasswordProtectedMacro()

    Dim Password As String

    Do Until Password = "edit"

        Password = InputBox("Restricted area. Please enter password below", "Password", "????")

        If Password = "" Then

            Exit Sub

        End If

    Loop

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-07-28T08:15:05+00:00

No, there is no way to make a standard input box mask passwords.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-07-27T09:44:30+00:00

Instead of using Inputbox, create a userform in the Visual Basic Editor with a text box for the password, an OK command button and a Cancel command button.

Set the PasswordChar property of the text box to (for example) *. Users will see **** in the text box, but your code in the On Click event of the OK button can read the value of the text box.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-07-28T06:46:45+00:00

    Many thanks for your reply, however I'm not familiar with userforms, is there no easy way or a line I can to the existing code ?

    Was this answer helpful?

    0 comments No comments