View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Damian Carrillo[_3_] Damian Carrillo[_3_] is offline
external usenet poster
 
Posts: 19
Default 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.