Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macros Wont Run After Hiding Sheet | New Users to Excel | |||
security med-but still wont open with macros | Excel Discussion (Misc queries) | |||
Wont keep changes | Excel Programming | |||
Date format from excel to CVS file wont. Change in CVS wont stay. | Excel Worksheet Functions | |||
Macros wont run?? | Excel Programming |