Results 1 to 7 of 7

Thread: Excel crashes while copying Worksheets

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    21

    Exclamation 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

  2. #2
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    Re: Excel crashes while copying Worksheets

    How many worksheets are you copying?

    Could you post the code?




    If you find any of my posts of good help, please rate it

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    21

    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.

  4. #4
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    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




    If you find any of my posts of good help, please rate it

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    21

    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.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    21

    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!

  7. #7
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    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
  •  



Click Here to Expand Forum to Full Width