Application Error

  • Thread starter Thread starter Hawk
  • Start date Start date
H

Hawk

I have created an excel spreadsheet that imports lots of
data and then processes it. I have been experiencing an
error when I run the procedure that processes the data.
However, if I insert some breakpoints in the procedure and
step thru the code, the error does NOT occur and
everything works fine.

Why would an error occur when run w/o breakpoints, and NOT
occur when run with breakpoints? Here is all the info:

The first error I get is:

Run-Time error '13':
Type mismatch

Then when I hit OK, I get the following:

Microsoft Excel-Climet.xls: excel.exe-Application Error
The instruction at "0x00000000" referenced memory
at "0x00000000". The memory could not be read.

Since the second error is poping up, I do not get a chance
to see at what line the "Type mismatch" has occurred. I
don't really know how there can be a "Type mismatch" since
it works fine when I step through the procedure using
breakpoints. I have absolutely no idea how to move
forward from here. I would truely appreciate any help.
TIA...
 
Hawk wrote...
I have created an excel spreadsheet that imports lots of
data and then processes it. I have been experiencing an
error when I run the procedure that processes the data.
However, if I insert some breakpoints in the procedure and
step thru the code, the error does NOT occur and
everything works fine.

Why would an error occur when run w/o breakpoints, and NOT
occur when run with breakpoints? Here is all the info:

The first error I get is:

Run-Time error '13':
Type mismatch

Then when I hit OK, I get the following:

Microsoft Excel-Climet.xls: excel.exe-Application Error
The instruction at "0x00000000" referenced memory
at "0x00000000". The memory could not be read.

Since the second error is poping up, I do not get a chance
to see at what line the "Type mismatch" has occurred. I
don't really know how there can be a "Type mismatch" since
it works fine when I step through the procedure using
breakpoints. I have absolutely no idea how to move
forward from here. I would truely appreciate any help.
TIA...


Hawk,

Do the following to help isolate your error.

Step 1:
At the top of the module:

Public L As String

Step 2:
Create the following subroutine.

Sub LogIt(ByVal stLine As String)
Open "C:\Test.txt" For Append As #1
L = stLine
Print #1, stLine
Close #1
End Sub


Step 3:

Go through your code (various functions and subroutines) and after every
line have

LogIt 100

after another line

LogIt 110

etc.



Step 4:

For problem subroutine or function

On Error Goto HadErr
'... the code
HadErr:
Debug.Print "Error: " & Err, Err.Description, "at " & L
Resume Next


Step 5:

Run your code. You can look at your file in C:\Test.txt and see where you
blew up.

If you use Logit 100, Logit 110, in increments of 10, you can go back and
more accurately pinpoint where the error occurs. I tend to use LogIt after
a few lines, not every single line. Once I have narrowed down where the
error is occuring, I use Logit after EVERY line.

Also you can look at your Immediate screen (I think it's immediate) to see
the debug.print message.

That should help you narrow down where things are breaking.

Hope that helps.

Best regards,
Kevin
 
Back
Top