LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Disabling VBE Break on All Errors Programmatically with DAO SetOpt

Hi All

I want to disable progammatically the VBE "Break on all errors" option when
launching a VBA Add-in that contains handled errors. I read the Microsoft
Knowledge Base Article (ACC2000: How to Turn Off "Break on All Errors" Option
in Code
View) on the process that should be used to do this with Access. That
approach appears to work with Microsoft Excel VBA Add-ins if a reference to
DAO is included.

The approach is broadly to include the following two subs in the add-in:

Public Sub SuspendBreaks()
SetOption "Error Trapping", 2
End Sub

Public Sub ResumeBreaks()
SetOption "Error Trapping",0
End Sub

These two subs are then incorporated into your procedures as follows:
Function MyCodeModule()
SuspendBreaks
On Error GoTo MyCodeModule_Err
MyCodeModule_Exit:
ResumeBreaks
Exit Function
MyCodeModule_Err:
Resume MyCodeModule_Exit
End Function

I have read often that there is no reliable method of disabling
Break-On-All-Errors. As an inexperienced programmer, I was wondering if
anyone had tried this approach and knew whether it is reliable when the VBA
add-in is widely distributed. What are its limitations? Does it work or am I
mistaken? What are all the other options for the first argument that in this
case contains a string "Error Trapping" (but is meant to be a long)?

Any thoughts would be much appreciated.

Regards

Jeremy

--
Jeremy Sadleir

 
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
VBE Options: Disabling Debug Option on All Errors JGS Excel Programming 1 December 4th 05 10:05 PM
Programmatically Disabling Excel Toolbars for one session only? BW Excel Programming 3 September 2nd 05 03:18 PM
How do I set VB to Break on All Errors? Barb[_5_] Excel Programming 1 September 14th 04 09:16 PM
Disabling the CONTROL + BREAK shortcut key function - HAVING PROBLEM - MY CODE DOES NOT WORK Marcello do Guzman Excel Programming 0 January 15th 04 02:41 AM
How to Programmatically Insert a Page Break Every Nth Row in a Range KK[_3_] Excel Programming 0 November 21st 03 12:49 AM


All times are GMT +1. The time now is 03:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"