ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make Inputbox field *****'s (https://www.excelbanter.com/excel-programming/378220-make-inputbox-field-%2A%2A%2A%2A%2As.html)

Don

Make Inputbox field *****'s
 
I'm creating a form to email a worksheet via CDO. However, of course, I
don't have email account passwords for the users of the file.
I am using Inputbox to have user fill in that information, but I want the
Inputbox field to result in *'s as the user enters the password.
Would application.writepassword work here or is there something better?

Don



Ron Coderre

Make Inputbox field *****'s
 
Not possible....at least in Excel 2002.
You should implement a UserForm with an OK and a Cancel button along with
possibly 2 textbox controls: Username, Password.

Set the PasswordChar property of the Password textbox to "*"

Here's a sample of form-level code that stores the Username and Password
values to global variables:

'-------------Start of Code------
Option Explicit

Private Sub cmdCancel_Click()
'User clicked the [Cancel] button
Unload Me
End Sub

Private Sub cmdSaveLoginParams_Click()
Dim strMsgText As String

strMsgText = ""
If tbxUsername.Text = "" Then
strMsgText = strMsgText & "-Invalid or Missing Username." & vbCr
End If
If tbxPassword.Text = "" Then
strMsgText = strMsgText & "-Missing Password." & vbCr
End If

If Len(strMsgText) 0 Then
'User inputs are invalid and must be corrected
strMsgText = "You must correct the following errors:" & vbCr &
strMsgText
MsgBox strMsgText
Exit Sub
Else
'Inputs are valid: Set global variables
prmUsername = tbxUsername.Text
prmPassword = tbxPassword.Text
Unload Me
End If

End Sub

'-------------End of Code------

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Don" wrote:

I'm creating a form to email a worksheet via CDO. However, of course, I
don't have email account passwords for the users of the file.
I am using Inputbox to have user fill in that information, but I want the
Inputbox field to result in *'s as the user enters the password.
Would application.writepassword work here or is there something better?

Don





All times are GMT +1. The time now is 05:43 PM.

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