I have a userform with a textbox that acts like a password screen.
Two problems:
1) I want to have the user hit enter after entering the password. Now, after one character is entered (changed) the macro is executed. I tried changing the event to enter (Private Sub TextBoxPassword_Enter), but then my userform won't load. ? I want the password to be more than one character.
2) How do I disable the "File Send" feature so that a file cannot be sent manually by the user? I want them to have to use a drop down menu to email the file to another department, which invokes the password requirement.
Private Sub TextBoxPassword_Change()
On Error Resume Next
Me.Hide
Dim NoGoMsg As String
NoGoMsg = "Invalid Password. File not sent."
TextBoxPassword.SetFocus
If TextBoxPassword.Value = "x" Then
ActiveWorkbook.SendMail Recipients:="Smith, Sally", Subject:="Authorized File Transfer", ReturnReceipt:=True
MsgBox "File Sent. You will get a 'return receipt'."
Unload UserFormEMail
ElseIf TextBoxPassword.Value <> "x" Then
MsgBox NoGoMsg, vbCritical
Unload UserFormEMail
End If
End Sub
Many thanks.
Two problems:
1) I want to have the user hit enter after entering the password. Now, after one character is entered (changed) the macro is executed. I tried changing the event to enter (Private Sub TextBoxPassword_Enter), but then my userform won't load. ? I want the password to be more than one character.
2) How do I disable the "File Send" feature so that a file cannot be sent manually by the user? I want them to have to use a drop down menu to email the file to another department, which invokes the password requirement.
Private Sub TextBoxPassword_Change()
On Error Resume Next
Me.Hide
Dim NoGoMsg As String
NoGoMsg = "Invalid Password. File not sent."
TextBoxPassword.SetFocus
If TextBoxPassword.Value = "x" Then
ActiveWorkbook.SendMail Recipients:="Smith, Sally", Subject:="Authorized File Transfer", ReturnReceipt:=True
MsgBox "File Sent. You will get a 'return receipt'."
Unload UserFormEMail
ElseIf TextBoxPassword.Value <> "x" Then
MsgBox NoGoMsg, vbCritical
Unload UserFormEMail
End If
End Sub
Many thanks.