|
-
Dec 9th, 2005, 01:26 PM
#1
Thread Starter
Junior Member
Excel crashes while copying Worksheets
After running the macro 3 or 4 times, it crashes with: "Error in automation 21474178481(80010108)" and closes the excel program.
I have tried to add "End" after the worksheets.copy sentence, but it does not work.
The argument with the problem is:
Worksheets.copy
I am using windows XP and office VB 2003.
Yorch
-
Dec 9th, 2005, 01:48 PM
#2
Addicted Member
Re: Excel crashes while copying Worksheets
How many worksheets are you copying?
Could you post the code?
-
Dec 9th, 2005, 01:53 PM
#3
Thread Starter
Junior Member
Re: Excel crashes while copying Worksheets
Actually I am copying the entire book, then I delete the sheets that I dont need:
Worksheets.Copy 'copy all the sheets to a new book / It crashes here
Application.DisplayAlerts = False
Sheets("Start").Delete
Sheets("DTC with no test plan").Delete
Sheets("DTC with test plan").Delete
Sheets("Guided functions").Delete
Sheets("Symp. with no test plan ").Delete
Sheets("Symp. with test plan ").Delete
Sheets("DTC Search Result").Visible = True
Sheets("FT Search Result").Visible = True
Sheets("Symptom Search Result").Visible = True
MsgBox "A file has been created", vbInformation, "System Information"
Application.DisplayAlerts = True 'always set the alerts back on when done
Do
fname = Application.GetSaveAsFilename("Manager Report", "*.xls(*.xls),*.xls")
Loop Until fname <> False
ActiveWorkbook.SaveAs Filename:=fname
ActiveWorkbook.Close
End - Some one told me this END was the solution, but nothing....
Also, some sheets have objects like charts.
-
Dec 9th, 2005, 02:00 PM
#4
Addicted Member
Re: Excel crashes while copying Worksheets
Try specifying the workbook:
Workbooks("Workbook_To_Copy").Worksheets.Copy
Otherwise could you post the file and I could find a solution faster for ya
-
Dec 9th, 2005, 02:19 PM
#5
Thread Starter
Junior Member
Re: Excel crashes while copying Worksheets
It didnt work. I have isoleted the code workbook copy, and it works, but in my complete macro it doesnt work.
The macro uses data bases, and the files are big, it takes time and instrucctions.
Thanks a lot!.
Last edited by yorch; Dec 16th, 2005 at 10:31 AM.
-
Dec 16th, 2005, 10:32 AM
#6
Thread Starter
Junior Member
Re: Excel crashes while copying Worksheets
Here some details:
In the original workbook, there are an specific number of sheets, after some procedures, it will be 3 charts created in 3 sheets. When the command Workbook.copy appear, then excel crashes. Do any one have some experience about it?.
I am working with:
Microsoft Office 2003 SP2
Microsoft Visual Basic 6.3
Thanks a lot!
-
Dec 16th, 2005, 12:54 PM
#7
Frenzied Member
Re: Excel crashes while copying Worksheets
Just a hunch here ... every time the system creates a workbook with the Copy method, it increments the default name of the opened book (Book1, Book2 ... etc.). The system remembers how many books have been opened, but I don't know if it saves any other information about each book. I also don't know how many books it can create before it runs out of automatic Book assignments.
Code:
Worksheets.Copy 'copy all the sheets to a new book / It crashes here
You might try forcing the new book to a specific name rather than allowing Excel to assign a default name. As I said, this is just a hunch. Good luck.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|