![]() |
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 |
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 |
All times are GMT +1. The time now is 02:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com