Need popup for password

  • Thread starter Thread starter SMILE
  • Start date Start date
S

SMILE

Hi Everyone
I need to run a macro to popup a window to enter a password with tw
buttons "OK" and "CANCEL"

Then I need to put a condition that

If the password is correct then

Application.Run "'DATA.xls'!CLEARDATA"

can someone help me???
Thanks in Advance
Tom
 
....and the rest of the question is "How can I hide or mask the VBA
code so an informed user can't hack the password?"
 
If you want to hide the password while the user is typing, you'll need a
Userform to mask the characters typed.

But if it's ok to see the password:

Option Explicit
Sub testme()

Dim myPWD As String

myPWD = InputBox(Prompt:="What's the password, Kenny?")

If myPWD = "ThisIsCorrect" Then
Application.Run "'DATA.xls'!CLEARDATA"
Else
MsgBox "nope"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top