PC Review
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Crashes
Excel Crash caused by VB Macro
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Crashes
Excel Crash caused by VB Macro
![]() |
Excel Crash caused by VB Macro |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > >. > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 >> >>. >> >. > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 >> >>. >> >. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

