ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Buttons in excel 2003 (https://www.excelbanter.com/excel-discussion-misc-queries/256293-buttons-excel-2003-a.html)

Neil Holden

Buttons in excel 2003
 
Hi all, I have a button and when pressed would like to say 'Please enter your
password, once the password has been validated the rest of the macro will run.

Is this possible?

Mike H

Buttons in excel 2003
 
Neil,

This a a simple way but you won't get a 'masked' password input box where
the characters typed appear as *** or something else. If you want to do that
then post back

Sub Password()
Dim Response As String
Dim MyPass As String
MyPass = "xxx"
Response = InputBox("Enter your password")
If Response < MyPass Then
MsgBox "Not Authorised"
Exit Sub
End If
'Your Code

End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Neil Holden" wrote:

Hi all, I have a button and when pressed would like to say 'Please enter your
password, once the password has been validated the rest of the macro will run.

Is this possible?


Mike H

Buttons in excel 2003
 
Sorry you wanted a button on the sheet. Put a button on the sheet, right
click it - view code and paste the code below in.

Private Sub CommandButton1_Click()
Dim Response As String
Dim MyPass As String
MyPass = "xxx"
Response = InputBox("Enter your password")
If Response < MyPass Then
MsgBox "Not Authorised"
Exit Sub
End If
Call YourSubName
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Neil Holden" wrote:

Hi all, I have a button and when pressed would like to say 'Please enter your
password, once the password has been validated the rest of the macro will run.

Is this possible?



All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com