Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
Prevent function errors caused by cutting & paste or drag & drop Learning More Each Day Excel Worksheet Functions 2 November 2nd 09 09:42 PM
Errors on opening Davíð Excel Discussion (Misc queries) 0 June 23rd 08 01:05 PM
errors when opening excel Philip Stromme Excel Discussion (Misc queries) 3 January 15th 08 07:27 PM
REF errors when opening excel in xp. works fine when opening wor. br Excel Discussion (Misc queries) 6 September 13th 05 11:41 AM
Errors when opening .csv files Brandan Lloyd Excel Discussion (Misc queries) 0 February 4th 05 02:12 PM


All times are GMT +1. The time now is 03:24 PM.

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"