Button Password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arjay
    New Member
    • Oct 2006
    • 1

    #1

    Button Password

    BUTTON PASSWORD
    When I activate a button to run a macro I want to be prompted for a password
    is this possible ?

    Any suggestions welcome.
  • albertw
    Contributor
    • Oct 2006
    • 267

    #2
    Originally posted by arjay
    BUTTON PASSWORD
    When I activate a button to run a macro I want to be prompted for a password
    is this possible ?

    Any suggestions welcome.
    it's possible
    if you put your routine inside cmdBUTTON_click ...
    this is just as simple example

    Private Sub cmdBUTTON_click ()
    On Error GoTo Err_Handler
    TryAgain:
    Password = InputBox("Enter your password", "ButtonPassword ")
    If Not Password = "MyPassword " Then GoTo TryAgain

    ..... enter your code here ....

    Exit Sub
    Err_Handler:
    End Sub

    or you may get your password from previously stored place in the register

    Private Sub cmdBUTTON_click ()
    On Error GoTo Err_Handler
    RegPassWord = GetSetting "ApplicationNam e", "Properties ", "PAssWordString ", "")
    TryAgain:
    Password = InputBox("Enter your password", "ButtonPassword ")
    If Not Password = RegPassWord Then GoTo TryAgain

    ..... enter your code here ....

    Exit Sub
    Err_Handler:
    End Sub

    save your password using SaveSetting...

    Comment

    Working...