Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Help with Error Handlers!!!

Hello all,

Using Excel 2002 (10.6501.6626) SP3

AAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!! THIS IS DRIVING ME NUTS!!!!!!!!!!!!!!!!!!!!!!!!

I've been working on this for several days now and I think that I have finally narrowed it down to this:

How can I get this to work correctly when I interrupt execution with [Ctrl] + [Break]?


With the following code, the error handler works correctly:

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

If mrngCurrRange = "Nothing" Then
' I KNOW THIS SYNTAX IS INCORRECT. I'VE ALREADY FOUND OUT THE CORRECT SYNTAX. This is just here to trigger a
legitimate error.
End If

'Statements that will cause the macro to run for a long time, hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf & Selection.Address

Exit Sub

End Sub



BUT with the following code AND INTERRUPTING EXECUTION WITH [Ctrl] + [Break], the error handler does not work correctly. Instead, I
get this error message: http://home.att.net/~ctbarbarin/file...ress_error.jpg

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

'Statements that will cause the macro to run for a long time, hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf & Selection.Address

Exit Sub

End Sub




How can I get this to work correctly when I interrupt execution with [Ctrl] + [Break]?

--
Thanks for any help anyone can provide,

Conan Kelly


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Help with Error Handlers!!!

If mrngCurrRange Is Nothing Then


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Using Excel 2002 (10.6501.6626) SP3

AAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!! THIS IS DRIVING ME

NUTS!!!!!!!!!!!!!!!!!!!!!!!!

I've been working on this for several days now and I think that I have

finally narrowed it down to this:

How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?


With the following code, the error handler works correctly:

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

If mrngCurrRange = "Nothing" Then
' I KNOW THIS SYNTAX IS INCORRECT. I'VE ALREADY FOUND OUT THE

CORRECT SYNTAX. This is just here to trigger a
legitimate error.
End If

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf &

Selection.Address

Exit Sub

End Sub



BUT with the following code AND INTERRUPTING EXECUTION WITH [Ctrl] +

[Break], the error handler does not work correctly. Instead, I
get this error message:

http://home.att.net/~ctbarbarin/file...ress_error.jpg

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf &

Selection.Address

Exit Sub

End Sub




How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?

--
Thanks for any help anyone can provide,

Conan Kelly




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Help with Error Handlers!!!

bob,

Thanks for the feed back, but please re-read the post.

I already knew that this syntax is incorrect (I stated that in the comments). I intentionally had that in there to trigger a
legitimate error. That is not where the problem lies. When I have this incorrect syntax in the code, the error handler works
correctly, BUT when I use [Ctrl] + [Break], the error handler does not work correctly.

Any more thoughts on the matter will be greatly appreciated,

Conan




"Bob Phillips" wrote in message ...
If mrngCurrRange Is Nothing Then


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Using Excel 2002 (10.6501.6626) SP3

AAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!! THIS IS DRIVING ME

NUTS!!!!!!!!!!!!!!!!!!!!!!!!

I've been working on this for several days now and I think that I have

finally narrowed it down to this:

How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?


With the following code, the error handler works correctly:

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

If mrngCurrRange = "Nothing" Then
' I KNOW THIS SYNTAX IS INCORRECT. I'VE ALREADY FOUND OUT THE

CORRECT SYNTAX. This is just here to trigger a
legitimate error.
End If

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf &

Selection.Address

Exit Sub

End Sub



BUT with the following code AND INTERRUPTING EXECUTION WITH [Ctrl] +

[Break], the error handler does not work correctly. Instead, I
get this error message:

http://home.att.net/~ctbarbarin/file...ress_error.jpg

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf &

Selection.Address

Exit Sub

End Sub




How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?

--
Thanks for any help anyone can provide,

Conan Kelly






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Help with Error Handlers!!!

That first example does not throw an error as the object is not declared, so
it is interpreted as a string and compared against "Nothing" and succeeds.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
bob,

Thanks for the feed back, but please re-read the post.

I already knew that this syntax is incorrect (I stated that in the

comments). I intentionally had that in there to trigger a
legitimate error. That is not where the problem lies. When I have this

incorrect syntax in the code, the error handler works
correctly, BUT when I use [Ctrl] + [Break], the error handler does not

work correctly.

Any more thoughts on the matter will be greatly appreciated,

Conan




"Bob Phillips" wrote in message

...
If mrngCurrRange Is Nothing Then


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Using Excel 2002 (10.6501.6626) SP3

AAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!! THIS IS DRIVING ME

NUTS!!!!!!!!!!!!!!!!!!!!!!!!

I've been working on this for several days now and I think that I have

finally narrowed it down to this:

How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?


With the following code, the error handler works correctly:

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

If mrngCurrRange = "Nothing" Then
' I KNOW THIS SYNTAX IS INCORRECT. I'VE ALREADY FOUND OUT

THE
CORRECT SYNTAX. This is just here to trigger a
legitimate error.
End If

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf

&
Selection.Address

Exit Sub

End Sub



BUT with the following code AND INTERRUPTING EXECUTION WITH [Ctrl] +

[Break], the error handler does not work correctly. Instead, I
get this error message:

http://home.att.net/~ctbarbarin/file...ress_error.jpg

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

'Statements that will cause the macro to run for a long time,

hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf

&
Selection.Address

Exit Sub

End Sub




How can I get this to work correctly when I interrupt execution with

[Ctrl] + [Break]?

--
Thanks for any help anyone can provide,

Conan Kelly








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Help with Error Handlers!!!

Bob,

I'm sorry about that. I should have mentioned that it is declared in the General Declarations of the module as a Range Variable.
If you are testing this on your computer, please declare it as a Range variable and it should throw an error then.

Thanks again for all of your help. Please excuse me if I seem a little short and rude. This problem is really driving me crazy.
I've been working on this for 3 or 4 days now. And since this is just for me personally, I've been spending way too much time on it
and haven't been getting alot of work done. It also seems like not very many people here know how to resolve it; I haven't had any
replies to my previous posts. I really want to figure this out so I can concentrate on work.

Once again, thank you for all of your help. It is greatly appreciated.

Conan


"Bob Phillips" wrote in message ...
That first example does not throw an error as the object is not declared, so
it is interpreted as a string and compared against "Nothing" and succeeds.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
bob,

Thanks for the feed back, but please re-read the post.

I already knew that this syntax is incorrect (I stated that in the

comments). I intentionally had that in there to trigger a
legitimate error. That is not where the problem lies. When I have this

incorrect syntax in the code, the error handler works
correctly, BUT when I use [Ctrl] + [Break], the error handler does not

work correctly.

Any more thoughts on the matter will be greatly appreciated,

Conan




"Bob Phillips" wrote in message

...
If mrngCurrRange Is Nothing Then


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Conan Kelly" <CTBarbarin at msn dot com wrote in message
...
Hello all,

Using Excel 2002 (10.6501.6626) SP3

AAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!! THIS IS DRIVING ME
NUTS!!!!!!!!!!!!!!!!!!!!!!!!

I've been working on this for several days now and I think that I have
finally narrowed it down to this:

How can I get this to work correctly when I interrupt execution with
[Ctrl] + [Break]?


With the following code, the error handler works correctly:

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

If mrngCurrRange = "Nothing" Then
' I KNOW THIS SYNTAX IS INCORRECT. I'VE ALREADY FOUND OUT

THE
CORRECT SYNTAX. This is just here to trigger a
legitimate error.
End If

'Statements that will cause the macro to run for a long time,
hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf

&
Selection.Address

Exit Sub

End Sub



BUT with the following code AND INTERRUPTING EXECUTION WITH [Ctrl] +
[Break], the error handler does not work correctly. Instead, I
get this error message:
http://home.att.net/~ctbarbarin/file...ress_error.jpg

Sub PasteReplaceNulls()
On Error GoTo PasteReplaceNulls_Err

Application.EnableCancelKey = xlErrorHandler

'Statements that will cause the macro to run for a long time,
hence the need for "Application.EnableCancelKey =
xlErrorHandler" above

PasteReplaceNulls_Err:
MsgBox ActiveWorkbook.Name & vbCrLf & ActiveSheet.Name & vbCrLf

&
Selection.Address

Exit Sub

End Sub




How can I get this to work correctly when I interrupt execution with
[Ctrl] + [Break]?

--
Thanks for any help anyone can provide,

Conan Kelly












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
Does 2 error handlers mess up excel? Nicole Seibert Excel Programming 4 April 5th 06 11:13 PM
Error Handlers JohnUK Excel Programming 2 September 5th 05 06:27 PM
Further Clarification with Event Handlers & Class Modules Kevin H. Stecyk[_2_] Excel Programming 2 January 25th 05 05:10 PM
Grouping Event handlers Ripan[_4_] Excel Programming 4 February 7th 04 02:40 PM
Problems with event handlers Italian Job Excel Programming 2 November 12th 03 01:26 AM


All times are GMT +1. The time now is 11:02 AM.

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"