+ Reply to Thread
Results 1 to 3 of 3

how can I assign a password to a command button

  1. #1
    Help!
    Guest

    how can I assign a password to a command button

    I am trying to crearte a command button that asks me for a question when I
    click on it. If I enter the correct password, then it should run.

  2. #2
    Norman Jones
    Guest

    Re: how can I assign a password to a command button

    Hi Help,

    Try something like:

    '=============>>
    Private Sub CommandButton1_Click()
    Dim Res As Variant

    Res = InputBox("Enter password")

    If Res <> "drowssap" Then
    MsgBox "Password not recognised"
    Exit Sub
    End If

    'Your button code

    End Sub
    '<<=============


    ---
    Regards,
    Norman


    "Help!" <[email protected]> wrote in message
    news:[email protected]...
    >I am trying to crearte a command button that asks me for a question when I
    > click on it. If I enter the correct password, then it should run.




  3. #3
    Kevin B
    Guest

    RE: how can I assign a password to a command button

    This actually doesn't apply a password per se, but it does require the
    correct word or phrase before processing:

    Private Sub CommandButton1_Click()

    Dim strPassword As String

    strPassword = InputBox("Enter the password for this " & _
    "command button.")

    If strPassword = "Password" Then
    'Do something here
    Else
    MsgBox "You did not enter the correct password for " & _
    "this command button."
    End If

    End Sub

    --
    Kevin Backmann


    "Help!" wrote:

    > I am trying to crearte a command button that asks me for a question when I
    > click on it. If I enter the correct password, then it should run.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1