none
c#: PowerPoint : PasteSpecial a copied chart from Excel, crashes with Shapes (unknown member) : Invalid request. RRS feed

  • Question

  • Shapes (unknown member) : Invalid request.  The specified data type is unavailable.

    Is the line I got if try to PasteSpecial a copied chart from Excel,

    private Microsoft.Office.Core.MsoTriState msoFalse = Microsoft.Office.Core.MsoTriState.msoFalse;

    private Microsoft.Office.Core.MsoTriState msoTrue = Microsoft.Office.Core.MsoTriState.msoTrue;

    ... xlShape.Copy(); ... pptSlide.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPasteDefault, msoFalse, "", 0, "", msoTrue);


    Anybody could give me a hint, why this happens and how to workaround it ?

    Thank you in advance.




    • Edited by HeinrichMS Monday, June 17, 2013 11:15 AM msoFalse, msoTrue have already been defined
    Thursday, June 6, 2013 9:23 AM

All replies

  • Hi HeinrichMS,

    Thank you for posting in the MSND Forum.

    Your issue is because you're not using the PasteSpecial method properly. The description of each parameter might be helpful.

    What if you change the code into below?

    xlShape.Copy();
    pptSlide.Shapes.PasteSpecial();

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 7, 2013 8:53 AM
    Moderator
  • Thank you, for replying.

    However, I just saw an error in the pasted code of mine. The last parameter is msoTrue, i.e. Im trying to connect the PPT Shape with those in Excel.

    pptSlide.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPasteDefault, msoFalse, "", 0, "", msoTrue);

    Btw, what do you mean with " using the PasteSpecial method properly"

    Regards,


    Friday, June 7, 2013 9:45 AM
  • Hi HeinrichMS,

    Sorry for the late in reply.

    Have you referenced to Microsoft.Office.Core in your project? If not, you can follow below steps.

    1. Right click on Reference -> Add reference -> ".NET" Tab -> Office.
    2. Add "using Office = Microsoft.Office.Core;"
    3. In the pastespecial method, modify msoFalse to Office.MsoTristate.msoFalse.
    4. For parameters which are optional and you want to omit them, you can use System.Type.Missing instead.

    Please feel free to let me know if there's any further questions.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 14, 2013 10:58 AM
    Moderator
  • Thanks for replying, but no...

    msoFalse, msoTrue have already been defined. I edited my post again...

    private Microsoft.Office.Core.MsoTriState msoFalse = Microsoft.Office.Core.MsoTriState.msoFalse;

    private Microsoft.Office.Core.MsoTriState msoTrue = Microsoft.Office.Core.MsoTriState.msoTrue;

    it is the PasteSpecial method which gives the problems, when linked to the excel sheet ! But I dont know how to avoid it !
    Monday, June 17, 2013 11:17 AM