Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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!" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign Function to a Command Button MUEEN SEHDI Excel Discussion (Misc queries) 1 October 29th 09 11:25 AM
Assign a macro to a command button SheriTingle Excel Discussion (Misc queries) 4 September 25th 06 06:38 PM
Assign a macro to a command button Tom E Excel Programming 3 July 8th 05 08:31 PM
command button and assign macro Dave Peterson[_3_] Excel Programming 2 May 27th 04 03:01 AM
Assign Macro to Command Button Shunt Excel Programming 1 August 7th 03 02:07 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"