Paswords...VB...and input boxes


Posted by Ian Mac on October 29, 2001 6:52 AM

All,

when someone click a button I want to prompt for a password before proceeding to the actual code.

Any Ideas??

Thank

Ian Mac

Posted by EDDIE G on October 29, 2001 7:09 AM

Go to tools, Macros, VB Editor
The VB editor will open

Go to tools, VBA Project Properties
Click the Protection Tab

Check the Lock Project For Viewing box

Enter the passwords and click OK

Store your password in a safe place and don't forget it.



Posted by Tom Urtis on October 29, 2001 7:17 AM

Is this what you want?

Ian,

You can preface some macros with an input box to force the user to enter a passcode in order to execute the macro, which I think you are asking for here:


Dim myPassword As String

myPassword = InputBox(prompt:="Please enter the password to proceed:", _
Title:="Password is required to auto-email this file.")

If myPassword <> "YourPassword" Then
MsgBox prompt:="Click OK to return to Report.", _
Title:="Cancelled -- correct password not entered", _
Buttons:=16

Else
The rest of your code goes here.

End If
End Sub


Any help?

Tom Urtis