Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel crashes when copying worksheets

Dear all,

I have created a workbook and an excel add in file. With the workbook open I
use a procedure from the add-in which creates copies of a worksheet. It
works with something like:
Worksheets("Template").Copy Befo=Sheets("WorkArea")
Worksheets("Template (2)").Visible = True
Worksheets("Template (2)").Activate
ActiveSheet.Name = "T" & HNumber
Then a routine is called which fills the new worksheet with data coming from
text files.
Call LoadData(FileName, ErrorCode)
This is then repeated in a loop.

This procedure works only 80 % of the time well. Every now and then Excel
(97 version) crashes and reports: the instruction at "0x...." referenced
memory at "0x...". The memory can not be "read". This happens very
irregularly and it happens either in the procedure part where the worksheet
is copied as well as in the procedure which loads the data . If I try to run
the whole procedure using the debugger the crash may not happen at all or at
a completely different point then before. I have tried many things to
improve the stability but none with real success. Can someone give any
guidelines how to improve the calculation stability ? Probably I have to
mention that the worksheets make a number of calls to functions contained in
the add-in. I have already tried to make these functions as save as
possible.

Thanks, any suggestions are appreciated

Martien


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Excel crashes when copying worksheets

Martien,

Maybe one of these will have something that helps...

http://support.microsoft.com/?kbid=210684
Xl2000: Copying Worksheet Programmatically Causes Run-Time Error 1004
http://support.microsoft.com/?kbid=177634
Xl97: Copy Method Of Sheets Object Causes Invalid Page Fault

Regards,
Jim Cone
San Francisco, CA

"Martien Janssen" wrote in message ...
Dear all,
I have created a workbook and an excel add in file. With the workbook open I
use a procedure from the add-in which creates copies of a worksheet. It
works with something like:
Worksheets("Template").Copy Befo=Sheets("WorkArea")
Worksheets("Template (2)").Visible = True
Worksheets("Template (2)").Activate
ActiveSheet.Name = "T" & HNumber
Then a routine is called which fills the new worksheet with data coming from
text files.
Call LoadData(FileName, ErrorCode)
This is then repeated in a loop.
This procedure works only 80 % of the time well. Every now and then Excel
(97 version) crashes and reports: the instruction at "0x...." referenced
memory at "0x...". The memory can not be "read". This happens very
irregularly and it happens either in the procedure part where the worksheet
is copied as well as in the procedure which loads the data . If I try to run
the whole procedure using the debugger the crash may not happen at all or at
a completely different point then before. I have tried many things to
improve the stability but none with real success. Can someone give any
guidelines how to improve the calculation stability ? Probably I have to
mention that the worksheets make a number of calls to functions contained in
the add-in. I have already tried to make these functions as save as
possible.
Thanks, any suggestions are appreciated
Martien

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 crashes on copying worksheet to new workbook browniebodrum Excel Discussion (Misc queries) 1 March 17th 12 12:27 AM
Excel crashes when copying to Word?? L.S. Excel Discussion (Misc queries) 10 August 13th 09 04:01 PM
Password protected workbook crashes copying worksheet SueD Excel Discussion (Misc queries) 0 April 21st 08 01:21 PM
What exactly excel do when copying worksheets? Salut Excel Discussion (Misc queries) 5 July 13th 07 07:24 PM
Copying worksheets into different Excel files Sonia Marie Excel Discussion (Misc queries) 1 February 15th 07 08:46 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"