Results 1 to 5 of 5

Excel 2010 VBA sheets(array(sheet1, )).copy command crashes excel - but not all the time.

Threaded View

  1. #4
    Registered User
    Join Date
    10-18-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Excel 2010 VBA sheets(array(sheet1, )).copy command crashes excel - but not all the ti

    I changed my approach and tried the following:

                   With ThisWorkbook
                     .Sheets("Sheet1").Copy
                     Set wbResults = ActiveWorkbook
                     .Sheets("Sheet2").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet3").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet4").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet5").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet6").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet7").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet8").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet9").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                     .Sheets("Sheet10").Copy after:=wbResults.Sheets(wbResults.Sheets.Count)
                   End With
    (wbResults is defined as a Workbook object)

    It copies the first three sheets then fails with:

    -2147417848
    Automation error - The object invoked has disconnected from its clients.
    Last edited by CJH@FSI; 10-21-2013 at 07:09 AM. Reason: added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code works in Windows excel 2003 and 2010 but crashes in Mac excel 2011
    By kiweed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2012, 08:46 PM
  2. [SOLVED] Macro works but crashes Excel 2010
    By Willardio in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-09-2012, 08:49 AM
  3. MS Excel 2010 crashes
    By Richard_G in forum Excel General
    Replies: 0
    Last Post: 07-11-2011, 08:57 AM
  4. MS Excel 2010 crashes
    By Richard_G in forum Excel General
    Replies: 1
    Last Post: 06-25-2011, 12:18 PM
  5. Code Crashes Excel 2010 but works in Excel 2003
    By aaronf316 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2011, 03:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1