Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi - I have a macro which opens a file and prompts a password to open it. If
I enter the password the file opens. However, if I put in the wrong password or hit cancel, it debugs. I am looking for some code that if the wrong password is entered it comes up with a message to say the wrong password has been entered - please try again. Additionally, if I hit cancel I want it to stop the file open process. Thanks in advance. |
#2
![]() |
|||
|
|||
![]()
Hi Ant
There are 2 ways out. One you can put a password in your macro. It will facilitate 2 things, 1 no one can see or alter your code. Secondly on putting the wrong password it won't prompt for debugging. Secondly, you can alter your code by adding On error Resume next in the beginning of the code. I hope these methods should help you with your problem. Regards, Raj "Ant" wrote: Hi - I have a macro which opens a file and prompts a password to open it. If I enter the password the file opens. However, if I put in the wrong password or hit cancel, it debugs. I am looking for some code that if the wrong password is entered it comes up with a message to say the wrong password has been entered - please try again. Additionally, if I hit cancel I want it to stop the file open process. Thanks in advance. |
#3
![]() |
|||
|
|||
![]()
Thanks Raj - perfect!
"Raj" wrote: Hi Ant There are 2 ways out. One you can put a password in your macro. It will facilitate 2 things, 1 no one can see or alter your code. Secondly on putting the wrong password it won't prompt for debugging. Secondly, you can alter your code by adding On error Resume next in the beginning of the code. I hope these methods should help you with your problem. Regards, Raj "Ant" wrote: Hi - I have a macro which opens a file and prompts a password to open it. If I enter the password the file opens. However, if I put in the wrong password or hit cancel, it debugs. I am looking for some code that if the wrong password is entered it comes up with a message to say the wrong password has been entered - please try again. Additionally, if I hit cancel I want it to stop the file open process. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sheet protection code conflicts with Pivot Table "auto refresh" | Excel Discussion (Misc queries) | |||
Sheet Protection and VBA Code | Excel Discussion (Misc queries) | |||
Make Change Case in Excel a format rather than formula | Excel Worksheet Functions | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) |