Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default MACROS WONT RUN

I have several macros I use on a daily basis and I tried to run them and
they give me an error of "Code execution has been interrupted" Can someone
tell me why I could be getting this message? I didn't hit contrl break and
have no idea what else i could have done wrong.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default MACROS WONT RUN

Post one of the offending macros

In the meantime step through the macro using Debug and F8 from the VBE
menu.

Maybe you can see where the error occurs.


Gord Dibben MS Excel MVP

On Tue, 18 Aug 2009 13:28:01 -0700, JOSEPH WEBER
wrote:

I have several macros I use on a daily basis and I tried to run them and
they give me an error of "Code execution has been interrupted" Can someone
tell me why I could be getting this message? I didn't hit contrl break and
have no idea what else i could have done wrong.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default MACROS WONT RUN

On Aug 19, 1:28*am, JOSEPH WEBER
wrote:
I have several macros I use on *a daily basis and I tried to run them and
they give me an error of "Code execution has been interrupted" *Can someone
tell me why I could be getting this message? I didn't hit contrl break and
have no idea what else i could have done wrong. *


This happens most of the times when you offen debug using CTRL +
BREAK, you put the following line in your macro:

Application.EnableCancelKey = xlDisabled

to avoid this.


-DK
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default MACROS WONT RUN



"dk" wrote:

On Aug 19, 1:28 am, JOSEPH WEBER
wrote:
I have several macros I use on a daily basis and I tried to run them and
they give me an error of "Code execution has been interrupted" Can someone
tell me why I could be getting this message? I didn't hit contrl break and
have no idea what else i could have done wrong.


This happens most of the times when you offen debug using CTRL +
BREAK, you put the following line in your macro:

Application.EnableCancelKey = xlDisabled

to avoid this.


-DK


This works, but I may have hit a button at the wrong time or something and
want to cancel the macro and can't. This just started yesterday and it is
affecting all of my macros. I have them saved in personal.xls. Is there an
option to run the macro step by step, because that is what it seems to be
doing. I can hit continue and the macro will run, but I set up the macros in
the first place so I don't have to sit here and manually do this.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default MACROS WONT RUN


Application.EnableCancelKey = xlDisabled


Be VERY careful with that. If you get into an unintentional loop,
you'll have to CTRL ALT DEL or TaskMgr to get out, and you'll lose
data and possibly corrupt the workbook.

A better approach is to set EnableCancelKey to xlErrorHandler. When
the user breaks, VBA throws an Error 18, which you can detect and take
the appropriate action. E.g.,

Application.EnableCancelKey = xlErrorHandler
On Error GoTo ErrHandler
'
' your code here
'
Exit Sub
ErrHandler:
If Err.Number = 18 Then
' break key hit. either
' get out,
' Resume to go back to the statement
' executing when Break was hit
' Resume Next to go back to the line
' after the line active when Break was hti
' prompt user for action then Resume
Else
' some other error
End If

End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Wed, 19 Aug 2009 02:41:09 -0700 (PDT), dk
wrote:

On Aug 19, 1:28*am, JOSEPH WEBER
wrote:
I have several macros I use on *a daily basis and I tried to run them and
they give me an error of "Code execution has been interrupted" *Can someone
tell me why I could be getting this message? I didn't hit contrl break and
have no idea what else i could have done wrong. *


This happens most of the times when you offen debug using CTRL +
BREAK, you put the following line in your macro:

Application.EnableCancelKey = xlDisabled

to avoid this.


-DK

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
Macros Wont Run After Hiding Sheet John Calder New Users to Excel 2 May 6th 09 11:14 PM
security med-but still wont open with macros Ian Elliott Excel Discussion (Misc queries) 1 March 17th 09 11:10 PM
Wont keep changes PauleyG Excel Programming 1 July 30th 08 12:16 AM
Date format from excel to CVS file wont. Change in CVS wont stay. Fish''s Mermaid Excel Worksheet Functions 1 October 14th 06 12:28 AM
Macros wont run?? tallpaul[_2_] Excel Programming 2 June 25th 06 05:30 PM


All times are GMT +1. The time now is 05:15 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"