Code Execution Interrupted ??

G

Guest

Hi All,
Just got my first 'code execution iterrupted message'.
I'm looking for guidance how on how to track the error down.
There's a ton of code, and the background is below.

It stopped @ The function @ the end of this posting.
The "end with" stmt was yellow.
The big macro that calls the function below has been running well
for months.

I commented the with.. end with and changed the Set Arg = stmt.
Got same message, this time on the If Not Arg stmt.
Ran without the function to see would happen.

The line that 'yellowed' next was the following:
If varname <> "" then 'this line
other code
end if

Hmmmm.....
Further examination,
In the addin I'm developing, a pretty big one,
the function is looking for duplicate values.
It executed 7 times OK, and on the 8th, I got the interruption.

More...
I use Rob Bovery's code cleaner about every other day. Tried it, No help.

The 'big' macro that's running is looking at a wrksht
containing LOTS of driving parms for the add-in. I'm loading values
into hundreds of public vars that are used as constants.
The macro is about 2000 lines of code, and has many calls
to other subs and functions.
The parms wrksheet is in a normal Wbk that is referenced to the addin.

The interruption is happening pretty much at the beginning
of the macro.
I had just added another 5 calls and the interruption started.

I'm taking the new calls out. I can put them into a separate macro.
I saw a posting here re: a KB# on error trapping which I will read next.

Any shortcuts here ?
Just what am I in for in the worst case?
If you need more facts, Please let me know.

Many thanks,
Neal Z



Public Function Find_Row1CF(ByVal Ws As Worksheet, sLookFor As String, _
Col As Integer, FmRow As Long, ToRow As Long, _
bXlWhole As Boolean) As Long

'Return the row of the cell where a string value is found in one column.
'Zero returned if not found. bXlwhole= true= string occupies entire cell.

Dim Arg As Range, WhoOrPrt

If bXlWhole = True Then WhoOrPrt = xlWhole Else WhoOrPrt = xlPart
If FmRow < 1 Then FmRow = 1
If ToRow < 1 Or ToRow > MSoMaxRow Then ToRow = MSoMaxRow
'With Ws

Set Arg = Ws.Range(Ws.Cells(FmRow, Col), Ws.Cells(ToRow, Col)) _
.Find(sLookFor, LookIn:=xlValues, lookat:=WhoOrPrt)

'End With
If Not Arg Is Nothing Then Find_Row1CF = Arg.Row
End Function
 
G

Guest

That sometimes happens when the procedure is of long duration without any
memory dumps. I don't know how your code is structured, but if you do have
long procedures, then breaking them down into shorter subs might ease the
stress on the system by allowing some memory dump periodically. Can't
guarantee the cause or the cure. Just an opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top