Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Andy Tallent
 
Posts: n/a
Default Password Loop question.

Hi,

JE McGimpsey was kind enough to share a variant of the following code with
me for password authentication;

Const sPASSWORD As String = "****"
Dim vResponse As Variant
Do
vResponse = Application.InputBox("Please enter the password")
If vResponse = False Then Exit Sub 'User Cancelled
If vResponse < sPASSWORD Then MsgBox "Unfortunately this is not the
correct password"
Loop Until vResponse = sPASSWORD

This is great but does anybody know how to limit this to three "loops". I
only want to give the individual inputting the password three attempts before
the application quits.

Thanks as always

Andy
--
Andy Tallent
  #2   Report Post  
P Sitaram
 
Posts: n/a
Default

Try:

Const sPASSWORD As String = "****"
Dim vResponse As Variant
Dim i as Integer
Do
vResponse = Application.InputBox("Please enter the password")
If vResponse = False Then Exit Sub 'User Cancelled
If vResponse < sPASSWORD Then
MsgBox "Unfortunately this is not the
correct password"
Else
Exit Loop
EndIf
i = i+1
Loop Until i < 3

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
I forgot my password for an excel workbook Hank Roberts (at the office) Excel Discussion (Misc queries) 1 March 8th 05 09:59 PM
bypass password when update linking of password protected file Yan Excel Discussion (Misc queries) 1 February 7th 05 11:29 PM
Applying Existing Password to New Spreadsheet Vic Excel Discussion (Misc queries) 1 January 27th 05 12:37 AM
How Delete Network Password Request-Worksheet in Website brsscreen Excel Worksheet Functions 0 December 14th 04 07:47 PM
Password cannot be removed twa14 Excel Discussion (Misc queries) 3 December 14th 04 11:27 AM


All times are GMT +1. The time now is 09:39 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"