Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Password Unprotect
Absolutely.
Near the beginning of your code, enter something like: On Error Goto ErrorTrap (ErrorTrap can be any text label you want) Then, add as your last lines: Exit Sub ErrorTrap: If Err.Number = 1004 then msgbox "Incorrect password. Please try again.", vbOkOnly endif So your entire code would be something like: On Error Goto ErrorTrap {rest of code} {last line of code} Exit Sub Errortrap: If Err.Number = 1004 then msgbox "Incorrect password", vbOkonly endif -----Original Message----- All Have a very simple macro within a workbook that basically all it does is Unprotect a sheet that is password protected (goes to the dialog box in order to enter in the password), e.g. Sub Administrator() ActiveSheet.Unprotect End Sub However if the person enters in the password incorrectly this then loads up the VBA module with the following error message: Run Time Error 1004 "The password you supplied is incorrect......" Is it possible to be able to handle errors within the VBA module where it just loads up a message box saying password entered is incorrect and has an OK button which goes back to the spreadsheet? Appreciate your help on this, as always! Cheers, Al Mackay ( ) . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I unprotect a workbook without the password? | Excel Discussion (Misc queries) | |||
Unprotect password- forgot? | Excel Worksheet Functions | |||
how can i unprotect worksheet with no password? | Excel Discussion (Misc queries) | |||
I need to unprotect a worksheet but I don't have the password. | Excel Discussion (Misc queries) | |||
Password - Protect, UnProtect | Excel Programming |