View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Error than Aborted Excel

If you had an error on that line, I'd check the following:

1) How are the variables declared
2) Break apart the line to see where it's having an error

--
HTH,

Barb Reinhardt



"Neal Zimm" wrote:

Hi All,

sHold = sHold & sColData & Space(MaxLenAy(iSortOrder) - Len(sColData))
Debug.Print sHold
sHold = ""

The lines above are part of a proc that prints evenly 'lined-up' columns.
Due to a bug, the Space math worked out to -2. The bug is now fixed,

BUT, Excel ENDED with the "Excel has a problem and has to close..."
display and my files were recovered. (No On Error .... code was in
place at the time.)

1. There was no run-time error. Why ?

When I extracted parts of the code to debug it, in testing the fix
I got a run- time error with a negative number.

2. Without putting all the code here, can you tell me what might be
the difference between getting a run-time error or not ?

3. Do you know of any other "common" uses of VBA that will abort Excel
without a run-time error so I can take special care with them?

Thanks,
Neal
--
Neal Z