PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Crashes Excel Crash caused by VB Macro

Reply

Excel Crash caused by VB Macro

 
Thread Tools Rate Thread
Old 03-06-2004, 05:51 PM   #1
Jules
Guest
 
Posts: n/a
Default Excel Crash caused by VB Macro


I am running Excel 2000 9.0.6926 SP-3

I have a VB macro with a "FOR" loop that opens each file
in a specified folder (files previously found using
the "Application.FileSearch" command), processes data from
the file into a worksheet, then closes the file without
saving it.

Intermittently, Excel crashes with the following error

EXCEL.EXE Application Error
The instruction at "0x6500bc82" referenced memory
at "0x02367d2c". The memory could not be "read".

This intermittent error is not dependent on the file being
processed, nor the number of files that have been
processed. Through the additiona of diagnostic code I
believe that the error, when it occurs, is close to the
point where the file is closed at the end of the "FOR"
loop. Here is the VB code used to close the file:-

ActiveWorkbook.Close SaveChanges:=False

The problem occurs about once every ten times the macro is
run, and has proved to be very resistent to changes or
restructing made to the VB code

Any assistance would be welcomed

  Reply With Quote
Old 09-06-2004, 01:24 PM   #2
Simon Murphy
Guest
 
Posts: n/a
Default Excel Crash caused by VB Macro

have you got a doevents in your loop?
Often this error is because excel still holds a reference
to part of a file, which then closes, making the memory
address invalid.
doevents lets windows clear up a bit
cheers
Simon
>-----Original Message-----
>I am running Excel 2000 9.0.6926 SP-3
>
>I have a VB macro with a "FOR" loop that opens each file
>in a specified folder (files previously found using
>the "Application.FileSearch" command), processes data

from
>the file into a worksheet, then closes the file without
>saving it.
>
>Intermittently, Excel crashes with the following error
>
>EXCEL.EXE Application Error
>The instruction at "0x6500bc82" referenced memory
>at "0x02367d2c". The memory could not be "read".
>
>This intermittent error is not dependent on the file

being
>processed, nor the number of files that have been
>processed. Through the additiona of diagnostic code I
>believe that the error, when it occurs, is close to the
>point where the file is closed at the end of the "FOR"
>loop. Here is the VB code used to close the file:-
>
>ActiveWorkbook.Close SaveChanges:=False
>
>The problem occurs about once every ten times the macro

is
>run, and has proved to be very resistent to changes or
>restructing made to the VB code
>
>Any assistance would be welcomed
>
>.
>

  Reply With Quote
Old 17-06-2004, 10:54 AM   #3
Guest
 
Posts: n/a
Default Excel Crash caused by VB Macro

Simon,
Many thanks for your suggestion - I have now added a
DoEvents statement immediately after closing the file at
the end of the DO loop - Excel has not crashed again so
far, but will need more testing to prove this has solved
the problem

Jules


>-----Original Message-----
>have you got a doevents in your loop?
>Often this error is because excel still holds a reference
>to part of a file, which then closes, making the memory
>address invalid.
>doevents lets windows clear up a bit
>cheers
>Simon
>>-----Original Message-----
>>I am running Excel 2000 9.0.6926 SP-3
>>
>>I have a VB macro with a "FOR" loop that opens each file
>>in a specified folder (files previously found using
>>the "Application.FileSearch" command), processes data

>from
>>the file into a worksheet, then closes the file without
>>saving it.
>>
>>Intermittently, Excel crashes with the following error
>>
>>EXCEL.EXE Application Error
>>The instruction at "0x6500bc82" referenced memory
>>at "0x02367d2c". The memory could not be "read".
>>
>>This intermittent error is not dependent on the file

>being
>>processed, nor the number of files that have been
>>processed. Through the additiona of diagnostic code I
>>believe that the error, when it occurs, is close to the
>>point where the file is closed at the end of the "FOR"
>>loop. Here is the VB code used to close the file:-
>>
>>ActiveWorkbook.Close SaveChanges:=False
>>
>>The problem occurs about once every ten times the macro

>is
>>run, and has proved to be very resistent to changes or
>>restructing made to the VB code
>>
>>Any assistance would be welcomed
>>
>>.
>>

>.
>

  Reply With Quote
Old 12-07-2004, 04:40 PM   #4
Guest
 
Posts: n/a
Default Excel Crash caused by VB Macro

The doevents statement did not solve my problem, but what
did was a move to MS Office 2003 - since installing that
three weeks ago I have had no more Excel crashes
Thanks for your help
Jules

>-----Original Message-----
>have you got a doevents in your loop?
>Often this error is because excel still holds a reference
>to part of a file, which then closes, making the memory
>address invalid.
>doevents lets windows clear up a bit
>cheers
>Simon
>>-----Original Message-----
>>I am running Excel 2000 9.0.6926 SP-3
>>
>>I have a VB macro with a "FOR" loop that opens each file
>>in a specified folder (files previously found using
>>the "Application.FileSearch" command), processes data

>from
>>the file into a worksheet, then closes the file without
>>saving it.
>>
>>Intermittently, Excel crashes with the following error
>>
>>EXCEL.EXE Application Error
>>The instruction at "0x6500bc82" referenced memory
>>at "0x02367d2c". The memory could not be "read".
>>
>>This intermittent error is not dependent on the file

>being
>>processed, nor the number of files that have been
>>processed. Through the additiona of diagnostic code I
>>believe that the error, when it occurs, is close to the
>>point where the file is closed at the end of the "FOR"
>>loop. Here is the VB code used to close the file:-
>>
>>ActiveWorkbook.Close SaveChanges:=False
>>
>>The problem occurs about once every ten times the macro

>is
>>run, and has proved to be very resistent to changes or
>>restructing made to the VB code
>>
>>Any assistance would be welcomed
>>
>>.
>>

>.
>

  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off