none
SaveCopyAs in PowerPoint causes HRESULT E_FAIL RRS feed

  • Question

  • Our VSTO Add-in for PowerPoint 2007/2010, when trying to save a presentation using SaveCopyAs causes the following exception for SOME of our users (quite commonly): Error HRESULT E_FAIL has been returned from a call to a COM component.

    Before getting to SaveCopyAs, the Add-in uses Presentation.Slides.Count without problems, so some PowerPoint Object Model commands do work.

    I was not able to reproduce the error locally on my computer and unfortunately, the users who received the error are not known to us personally so I cannot debug it on their systems.

    Checking their log files does not really help to pinpoint the problem:
    - The users have various Windows versions (xp, vista, 7, 32bit, 64bit)
    - Some use office 2007, some 2010
    - Versions of their PIA and PowerPoint match (12 to 12, 14 to 14)
    - All of them have VBA for office installed and Enabled - Some of them are admins, others not.

    Any ideas of how to solve this? Maybe other things I need to check and add to the log files?

    Tuesday, May 24, 2011 12:49 PM

All replies

  • Hello,

    Doe the user has appropriate permissions for the folder where you save the file? What values you pass to that method?


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Tuesday, May 24, 2011 2:44 PM
  • That's a good question, I already checked that. The user can write to that directory and even to the same filename. After saveCopyAs fails, I instructed the program to write a few bytes to exactly the same path and filename it was trying to save the presentation to, and it does it. 

    The parameters I use:

     

    presentation.SaveCopyAs(copiedPresentationFilename, PpSaveAsFileType.ppSaveAsOpenXMLPresentation, MsoTriState.msoFalse);

    Any other ideas?

     


    Wednesday, May 25, 2011 8:41 AM
  • Hi Arie,

    I haven't encounter such problem before and I have also tested your code snippet on my side, it works well. Do your customers machines have the full featured installed of Office? Tell them try to reinstall the Office application to see whether such problem persists.

    Hope the suggestion helps.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Bruce Song Thursday, June 2, 2011 12:44 PM
    • Marked as answer by Bruce Song Tuesday, June 7, 2011 11:15 AM
    • Unmarked as answer by Bruce Song Friday, June 10, 2011 7:19 AM
    • Unproposed as answer by Bruce Song Friday, June 10, 2011 7:20 AM
    Thursday, May 26, 2011 8:52 AM
  • Hi Arie,

    What's the status of the problem on the side of your customers? If you still have any concern on the thread, just feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 1, 2011 12:44 PM
  • The problem still exists and is common. Any other ideas?
    Thursday, June 9, 2011 3:16 PM
  • Hello Arie,

    Do you create threads in your add-in? If positive, make sure that you don't use any PowerPoint Model objects in such threads.

     


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Friday, June 10, 2011 7:33 AM
  • The "SaveCopyAs" fails before such threads are created.

    BTW - I am using threads which access a lot the PowerPoint Object Model. Is there a problem with that?

     

    Monday, October 3, 2011 3:05 PM
  • There is a problem: all Office object models are not thread-safe. See On using threads in managed Office extensions.
    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Monday, October 3, 2011 8:14 PM