Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping VBA Debug pop up boxes?


Hi all, I have a workbook that has quite a lot of automation in it an
all works fine n dandy however, if the user causes an error (lets sa
Runtime Error) then of course the Debug box pops up, but i hav
protected my code if the user chooses Debug then none of the automatio
in my workbok works rendering it usless!

Is there any way of bypassing this and allowing my code to ac
normally?, is the solution perhaps to put On Error Resume Next in ever
block of code? (hope not!)

i have stopped the user right clicking (i would like to stop keyboar
shortcuts too!) but they could still drag a cell which will cause a
error or select more than one cell at a time which causes a
error....................How can i prevent these things causing
problem with the code i use?

Regards,
Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=57102

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Stopping VBA Debug pop up boxes?

You certainly should not put On Error Resume Next in each module, that will
just ignore errors. You need to trap errors yourself and handle them, by
putting a an On Error Goto label at the head of the procedures. I typically
add it to the initiaiting procedure to trap unexpected errors, and then just
throw out as much detail as I can, and quit.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Simon Lloyd"
wrote in message
...

Hi all, I have a workbook that has quite a lot of automation in it and
all works fine n dandy however, if the user causes an error (lets say
Runtime Error) then of course the Debug box pops up, but i have
protected my code if the user chooses Debug then none of the automation
in my workbok works rendering it usless!

Is there any way of bypassing this and allowing my code to act
normally?, is the solution perhaps to put On Error Resume Next in every
block of code? (hope not!)

i have stopped the user right clicking (i would like to stop keyboard
shortcuts too!) but they could still drag a cell which will cause an
error or select more than one cell at a time which causes an
error....................How can i prevent these things causing a
problem with the code i use?

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile:

http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=571027



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping VBA Debug pop up boxes?


Thanks for the reply Bob, if i used On Error Goto 0 would that preven
runtime Errors occuring or VBA error boxes poping up? would it als
prevent the code from being stopped ?(as is the case now), other tha
using the ill fated On error Resume Next, i have no experience of erro
handling, i know i have been visiting this forum for a couple of year
and picked up so much from all the help here but, you only learn or as
questions on things that are directly important at th
time................ok call it laziness! but i still need guidance.

Regards,
Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=57102

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Stopping VBA Debug pop up boxes?

Simon,

"...but i still need guidance."
Review "On Error Statement" in the vba help file.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Stopping VBA Debug pop up boxes?

No! If you read On Error Goto 0 in the help, you will see it says that it
.... Disables any enabled error handler in the current procedure. That means
that errors will break, causing the Debug popup, which is exactly what you
don't want.

You need something like

Option Explicit

Public sProcedure As Sring

Sub Main()

On Error Goto errhandler

sProcedure = "Main"

'some code

Call Macro1

'some more code

Call Macro2

'final code

Exit Sub

errHandler:
MsgBox "Error in procedu " & sProcedure
MsgBox "Error " & err.Number & " - " & err.Description
'and any other info you think might help

End Sub

Sub Macro1()

sProcedure = "Macro1"

'code

End Sub

Sub Macro2()

sProcedure = "Macro2"

'code

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Simon Lloyd"
wrote in message
...

Thanks for the reply Bob, if i used On Error Goto 0 would that prevent
runtime Errors occuring or VBA error boxes poping up? would it also
prevent the code from being stopped ?(as is the case now), other than
using the ill fated On error Resume Next, i have no experience of error
handling, i know i have been visiting this forum for a couple of years
and picked up so much from all the help here but, you only learn or ask
questions on things that are directly important at the
time................ok call it laziness! but i still need guidance.

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile:

http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=571027



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
Data validation boxes, outputting a final number from the boxes MDH Excel Discussion (Misc queries) 1 November 16th 06 12:41 AM
How To Use Debug Minitman[_4_] Excel Programming 4 January 18th 06 05:42 PM
Debug VBA Paul Cowan Excel Programming 0 December 9th 04 01:11 PM
* How do we debug this? ... Kris Excel Programming 2 October 29th 04 02:17 AM
debug help Tom Ogilvy Excel Programming 0 August 27th 03 07:10 PM


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

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"