PC Review


Reply
Thread Tools Rate Thread

How to Diagnose Why "Code Execution has been interrupted"

 
 
Neal Zimm
Guest
Posts: n/a
 
      23rd Jan 2008
Hi All,
For going on 2 years I've been building a large addin, over 100 modules,
with 800 or so Subs and Functions.

I'm not a 'professional' developer and am naive re: techie aspects of
VIBDE enironment.

Two days ago I started getting the Code execution has been interrupted
error.
The problem does not happen all the time.
Macro's with not a lot of calls seem to do 'better'.

Some of the code below is in called Subs or functions that are 5 levels
'deep' from the Sub executed via the menu I've built for the addin.

Other than adding a new module to the app, I don't recall doing anything
really different.

I don't know what to do next to diagnose the condition causing the
interruption, and am seeking suggestions.

Samples of code with the error are below, they are NOT the same from
running to running.
Work done, and some facts are below, please let me know if you need more
facts.

Dell desktop, 346 meg memory, both disk drives recently defragged, XP
home version.

4 workbooks are open in addition to addin, addin is 10 meg, workbook size
ranges from < 30K to 7 meg.

Have used Rob Bovey's code cleaner on ALL of the above. (daily on the
addin)

In ALL cases: each execution continues to successful end when Continue is
clicked, err.number is zero in the immediate window.

Every module in the addin is < 64K in size. Subs and functions range from
a couple of lines to a max of about 1500.

I get the error when running Bovey's code cleaner and Documentor as well
as my own code and it too completes when Continue is clicked.

Put in some "On error resume next" lines before the locations where the
interruption seems to repeat, and the code stops on the 'On error...' too.

Thanks much,
Neal Z.


Examples of code seen when debug button clicked:

If Chars = "x" Or Chars = "" Or Chars = Dflt Then 'THIS LINE WAS YELLOW


'PART OF A ROW LOOP EDITING VALUES IN CELLS

' ELIM any lead/trail blanks from column B.
If Len(.Cells(Row, iColB).Value) <> Len(Trim(.Cells(Row, iColB).Value)) Then
.Cells(Row, iColB).Value = Trim(.Cells(Row, iColB).Value)
End If 'THIS LINE WAS YELLOW


'below part of larger macro formating a sheet

If .Rows("2:" & (gSVCcolHdrRow - 1)).RowHeight = 16 Then Else: .Rows("2:"
& (gSVCcolHdrRow - 1)).RowHeight = 16


'below, same macro as above
.Rows((FirstCpyRow - 10) & ":" & (FirstCpyRow + PaEndRow +
10)).ClearContents


'different Mac from above, but again, a .rows process

If SyPLastRow > 0 Then
SyPws.Columns.Hidden = False
SyPws.Rows("1:" & SyPLastRow).Hidden = False 'THIS LINE WAS YELLOW
Else
GoSub Err_ColBNotFound
End If


Sub SCRNback(bASU As Boolean)
'Restore screenupdating to prior value.
Application.ScreenUpdating = bASU
End Sub 'this LINE was YELLOW


Public Function Find_ValInColF(Ws As Worksheet, ByVal sLookFor As String, _
ByVal Row As Long, ByVal FmCol As Integer, ByVal ToCol As Integer) As
Integer
' Return column of the cell where a value is found in a row.
Dim Arg As Range

If FmCol < 1 Then FmCol = 1
If ToCol < 1 Or ToCol > MSoMaxCol Then ToCol = MSoMaxCol 'mso max=256

Set Arg = Ws.Range(Ws.Cells(Row, FmCol), Ws.Cells(Row, ToCol)) _
.Find(sLookFor, LookIn:=xlValues, Lookat:=xlWhole)

' LINE BELOW WAS YELLOW, Arg HAD a value.

If Not Arg Is Nothing Then Find_ValInColF = Arg.Column
End Function

--
Neal Z
 
Reply With Quote
 
 
 
 
Bob Flanagan
Guest
Posts: n/a
 
      23rd Jan 2008
Neil, if the code is just stopping with the line highlighted, then set a
password on the project and click on the option to hide the project from
viewing. I have seen similar problems and that appears to be the only
solution.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Neal Zimm" <(E-Mail Removed)> wrote in message
news:6C89A5F8-B096-4E4E-8623-(E-Mail Removed)...
> Hi All,
> For going on 2 years I've been building a large addin, over 100 modules,
> with 800 or so Subs and Functions.
>
> I'm not a 'professional' developer and am naive re: techie aspects of
> VIBDE enironment.
>
> Two days ago I started getting the Code execution has been interrupted
> error.
> The problem does not happen all the time.
> Macro's with not a lot of calls seem to do 'better'.
>
> Some of the code below is in called Subs or functions that are 5 levels
> 'deep' from the Sub executed via the menu I've built for the addin.
>
> Other than adding a new module to the app, I don't recall doing anything
> really different.
>
> I don't know what to do next to diagnose the condition causing the
> interruption, and am seeking suggestions.
>
> Samples of code with the error are below, they are NOT the same from
> running to running.
> Work done, and some facts are below, please let me know if you need more
> facts.
>
> Dell desktop, 346 meg memory, both disk drives recently defragged, XP
> home version.
>
> 4 workbooks are open in addition to addin, addin is 10 meg, workbook
> size
> ranges from < 30K to 7 meg.
>
> Have used Rob Bovey's code cleaner on ALL of the above. (daily on the
> addin)
>
> In ALL cases: each execution continues to successful end when Continue
> is
> clicked, err.number is zero in the immediate window.
>
> Every module in the addin is < 64K in size. Subs and functions range
> from
> a couple of lines to a max of about 1500.
>
> I get the error when running Bovey's code cleaner and Documentor as well
> as my own code and it too completes when Continue is clicked.
>
> Put in some "On error resume next" lines before the locations where the
> interruption seems to repeat, and the code stops on the 'On error...' too.
>
> Thanks much,
> Neal Z.
>
>
> Examples of code seen when debug button clicked:
>
> If Chars = "x" Or Chars = "" Or Chars = Dflt Then 'THIS LINE WAS YELLOW
>
>
> 'PART OF A ROW LOOP EDITING VALUES IN CELLS
>
> ' ELIM any lead/trail blanks from column B.
> If Len(.Cells(Row, iColB).Value) <> Len(Trim(.Cells(Row, iColB).Value))
> Then
> .Cells(Row, iColB).Value = Trim(.Cells(Row, iColB).Value)
> End If 'THIS LINE WAS YELLOW
>
>
> 'below part of larger macro formating a sheet
>
> If .Rows("2:" & (gSVCcolHdrRow - 1)).RowHeight = 16 Then Else: .Rows("2:"
> & (gSVCcolHdrRow - 1)).RowHeight = 16
>
>
> 'below, same macro as above
> .Rows((FirstCpyRow - 10) & ":" & (FirstCpyRow + PaEndRow +
> 10)).ClearContents
>
>
> 'different Mac from above, but again, a .rows process
>
> If SyPLastRow > 0 Then
> SyPws.Columns.Hidden = False
> SyPws.Rows("1:" & SyPLastRow).Hidden = False 'THIS LINE WAS YELLOW
> Else
> GoSub Err_ColBNotFound
> End If
>
>
> Sub SCRNback(bASU As Boolean)
> 'Restore screenupdating to prior value.
> Application.ScreenUpdating = bASU
> End Sub 'this LINE was YELLOW
>
>
> Public Function Find_ValInColF(Ws As Worksheet, ByVal sLookFor As String,
> _
> ByVal Row As Long, ByVal FmCol As Integer, ByVal ToCol As Integer) As
> Integer
> ' Return column of the cell where a value is found in a row.
> Dim Arg As Range
>
> If FmCol < 1 Then FmCol = 1
> If ToCol < 1 Or ToCol > MSoMaxCol Then ToCol = MSoMaxCol 'mso max=256
>
> Set Arg = Ws.Range(Ws.Cells(Row, FmCol), Ws.Cells(Row, ToCol)) _
> .Find(sLookFor, LookIn:=xlValues, Lookat:=xlWhole)
>
> ' LINE BELOW WAS YELLOW, Arg HAD a value.
>
> If Not Arg Is Nothing Then Find_ValInColF = Arg.Column
> End Function
>
> --
> Neal Z



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why am I getting "Code execution has been interrupted" message Chris Freeman Microsoft Excel Programming 3 23rd Jun 2009 11:11 PM
Alien abduction of VB: "Code execution has been interrupted..." Paul B. Microsoft Excel Programming 3 31st Jul 2008 03:02 AM
"Code execution has been interrupted" message Dave O Microsoft Excel Misc 5 12th Jun 2008 11:35 PM
VBA "Code execution interrupted" error on End Sub and End IF c0mmands?? Allan P. London, CPA Microsoft Excel Programming 0 13th May 2008 09:01 PM
"code execution has been interrupted" message on startup of Word =?Utf-8?B?Z2FicmlvbGFpc2xhbmRlcg==?= Microsoft Word Document Management 2 16th Nov 2004 07:58 AM


Features
 

Advertising
 

Newsgroups
 


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