none
Excel 2010 cannot save when worksheets copied via VBA from another file contain image RRS feed

  • Question

  • When worksheets containing images are copied into another file via VBA, the target file will not save until all images are deleted from it.  These images are mostly PNG files (SNIP IT screenshots or our internally designed tickmark images).  If worksheet copy is manually done on the UI, most of the time this error will not happen.  However, when the copying is done via VBA, there is no chance I can save the destination file with any image copied over with a worksheet.  

    I understand that there was an earlier bug about images from worksheet copy not showing the image itself but a message about the image was missing.  I wonder if this is a related bug.  I used to have that bug in Excel 2007 but not in Excel 2010 right now.  

    I'm using Office 2010 32-bit version. Our QA team tested the Service Pack 2 and got the same error result.  

    Monday, December 15, 2014 11:01 PM

Answers

  • Hello,

    Please post your vba code and the error message here so that we can troubleshoot the problem easily. Thank you.

    I tested with Excel 2010, this VBA code works fine for me to copy the worksheet with png images to another workbook. If it doesn't work for you, please post any error messages here.

    Sub CopyWorksheetWithImagesToAnotherFile()
        Application.DisplayAlerts = False
        
        Dim anotherWorkbook As Workbook
        Set anotherWorkbook = Application.Workbooks.Open("C:\test2.xlsx")
        Sheet1.Copy After:=anotherWorkbook.Sheets(1)
        
        anotherWorkbook.Save
        anotherWorkbook.Close
    End Sub


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 18, 2014 9:03 AM
    Moderator

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.
    Tuesday, December 16, 2014 6:28 AM
  • Thank you George!  Somehow in my search for answers I got some related posts on this forum, so I just posted here.  I will remember to use MSDN Forum next time.  
    Tuesday, December 16, 2014 8:22 AM
  • post the vba code here
    Thursday, December 18, 2014 8:37 AM
  • Hello,

    Please post your vba code and the error message here so that we can troubleshoot the problem easily. Thank you.

    I tested with Excel 2010, this VBA code works fine for me to copy the worksheet with png images to another workbook. If it doesn't work for you, please post any error messages here.

    Sub CopyWorksheetWithImagesToAnotherFile()
        Application.DisplayAlerts = False
        
        Dim anotherWorkbook As Workbook
        Set anotherWorkbook = Application.Workbooks.Open("C:\test2.xlsx")
        Sheet1.Copy After:=anotherWorkbook.Sheets(1)
        
        anotherWorkbook.Save
        anotherWorkbook.Close
    End Sub


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 18, 2014 9:03 AM
    Moderator