Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent VBE from opening on errors?
In XL 2003, when my code errors (more than I want it to!!), the VBE
opens with the offending line of code highlighted in yellow. How can I prevent this from happening so the user doesn't see the code? Ed |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent VBE from opening on errors?
On Apr 4, 1:07*pm, Ed from AZ wrote:
In XL 2003, when my code errors (more than I want it to!!), the VBE opens with the offending line of code highlighted in yellow. *How can I prevent this from happening so the user doesn't see the code? Ed You need to look into error handling. Briefly, suppose that MySub() is crashing at times. Modify MySub() as follows Sub MySub() On Error GoTo ErrHandler 'other labels for the error handler are ok 'The original code goes here Exit Sub 'put this line where you had End Sub in the original code ErrHandler: 'put code to handle the error here, for example: MsgBox "An error has been encountered" End Sub It is a relatively involved topic. You could start by looking up "On Error" in the on line help. hth |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent VBE from opening on errors?
Your first line of defense is addressing your bugs, and it will have other
benefits like your code will run to completion successfully.<g But in the meantime, if you don't want users to see your code when it errors (or any other time), protect the project via Tools, VB Project Properties, Protection. -- Jim "Ed from AZ" wrote in message ... In XL 2003, when my code errors (more than I want it to!!), the VBE opens with the offending line of code highlighted in yellow. How can I prevent this from happening so the user doesn't see the code? Ed |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent VBE from opening on errors?
Thanks, Jim. Until I can kill all my bugs, I'll use the protection.
I've got the sheet protected, and I'm not used to using it like that so I've missed a spot or two where I need to unprotect. But if the VBE opens up, there's the Unprotect with the password in plain sight. Ed On Apr 4, 10:27*am, "Jim Rech" wrote: Your first line of defense is addressing your bugs, and it will have other benefits like your code will run to completion successfully.<g But in the *meantime, if you don't want users to see your code when it errors (or any other time), protect the project via Tools, VB Project Properties, Protection. -- Jim "Ed from AZ" wrote in ... In XL 2003, when my code errors (more than I want it to!!), the VBE opens with the offending line of code highlighted in yellow. *How can I prevent this from happening so the user doesn't see the code? Ed- Hide quoted text - - Show quoted text - |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent VBE from opening on errors?
If you protect the project (not the worksheet, workbook or file), then when the
code blows up, the user won't see the code. But be aware that protection of the project isn't foolproof. It can be broken by some free tools on the internet, along with password cracking programs (that are not free). Ed from AZ wrote: Thanks, Jim. Until I can kill all my bugs, I'll use the protection. I've got the sheet protected, and I'm not used to using it like that so I've missed a spot or two where I need to unprotect. But if the VBE opens up, there's the Unprotect with the password in plain sight. Ed On Apr 4, 10:27 am, "Jim Rech" wrote: Your first line of defense is addressing your bugs, and it will have other benefits like your code will run to completion successfully.<g But in the meantime, if you don't want users to see your code when it errors (or any other time), protect the project via Tools, VB Project Properties, Protection. -- Jim "Ed from AZ" wrote in ... In XL 2003, when my code errors (more than I want it to!!), the VBE opens with the offending line of code highlighted in yellow. How can I prevent this from happening so the user doesn't see the code? Ed- Hide quoted text - - Show quoted text - -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prevent function errors caused by cutting & paste or drag & drop | Excel Worksheet Functions | |||
Errors on opening | Excel Discussion (Misc queries) | |||
errors when opening excel | Excel Discussion (Misc queries) | |||
REF errors when opening excel in xp. works fine when opening wor. | Excel Discussion (Misc queries) | |||
Errors when opening .csv files | Excel Discussion (Misc queries) |