PDA

View Full Version : Solved: ******** Instead of Password



Dowsey1977
10-10-2005, 04:46 AM
Hi,

I think this may be a strange request, but....

I am using the below code to save a workbook, prompt for a password and then send an email. Is there anyway to have whatever the user types into the InputBox display as stars (***'s)??


Sub sendto()
'
' sendto Macro
' Macro recorded 13/06/2005 by crayfourd
Dim Rcpts(1 To 3) As String
Dim Name, Password As String
Name = "Form 6 Cash Processing Request - " & Range("D97").Value
Password = InputBox("Please enter your allocated password", "Spreadsheet Password Entry")
ThisWorkbook.SaveAs FileName:=Name, Password:=Password
Rcpts(1) = "simon.dowse@bpb.barclays.com"
Rcpts(2) = ""
Rcpts(3) = ""
ThisWorkbook.SendMail Recipients:=Rcpts, Subject:=Name, ReturnReceipt:=True
MsgBox "The report has now been emailed to Cash Processing for action " & Application.UserName
End Sub

johnske
10-10-2005, 05:01 AM
Hi Dowsey,

There is one way, but it's a lot easier to make a userform that looks like an input box and use the Password char property in a textbox on it e.g.
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
TextBox1.PasswordChar = "*"
End SubHTH,
John

Dowsey1977
10-10-2005, 06:12 AM
Excellent...many thanks!!