ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Debug Error (https://www.excelbanter.com/excel-programming/286274-debug-error.html)

Todd Huttenstine[_2_]

Debug Error
 
Hey guys,

When I am running a particular code (loop code) and I stop
it, I get a debug error. I would prefer to get a
messagebox saying "Program Stopped!"

How would I do this?

I was thinking maybe with a label?

Thanx

Todd Huttenstine

Rob van Gelder[_4_]

Debug Error
 
I came across this article which should work:
http://groups.google.co.nz/groups?hl...6F6%40kpmg.com

Sub noesc()
'set it up so if user hits esc, you send it to error handler
Application.EnableCancelKey = xlErrorHandler
On Error GoTo 1
While True
ActiveCell.Offset(1).Select 'press esc here
Wend
Exit Sub
1:
MsgBox "You pressed esc"
End Sub


"Todd Huttenstine" wrote in message
...
Hey guys,

When I am running a particular code (loop code) and I stop
it, I get a debug error. I would prefer to get a
messagebox saying "Program Stopped!"

How would I do this?

I was thinking maybe with a label?

Thanx

Todd Huttenstine




Todd Huttenstine[_2_]

Debug Error
 
Well the user really wont hit Esc, they will just hit
cancel on an Outlook Email Dialog screen. I want it to be
something like this logic....


On Error GoTo Problem:
Problem:
MsgBox "Program Stopped!"
Exit Sub

Is this possible? RIght now if I put that in my code it
will run through that code and exit sub.


Thanx
-----Original Message-----
Hey guys,

When I am running a particular code (loop code) and I

stop
it, I get a debug error. I would prefer to get a
messagebox saying "Program Stopped!"

How would I do this?

I was thinking maybe with a label?

Thanx

Todd Huttenstine
.


Rob van Gelder[_4_]

Debug Error
 
Looks good to me

"Todd Huttenstine" wrote in message
...
Well the user really wont hit Esc, they will just hit
cancel on an Outlook Email Dialog screen. I want it to be
something like this logic....


On Error GoTo Problem:
Problem:
MsgBox "Program Stopped!"
Exit Sub

Is this possible? RIght now if I put that in my code it
will run through that code and exit sub.


Thanx
-----Original Message-----
Hey guys,

When I am running a particular code (loop code) and I

stop
it, I get a debug error. I would prefer to get a
messagebox saying "Program Stopped!"

How would I do this?

I was thinking maybe with a label?

Thanx

Todd Huttenstine
.





All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com