Reputation: 77
I'm trying to paste metapicture from clipboard (from excel) into a powerpoint slide using the code part below. It works fine when I use ppPasteDefault or ppPasteBitmap paste types but fails when using ppPasteMetafilePicture or prety much anything else.
I receive error; "Shapes (unknown member) : Invalid request. The specified data type is unavailable."
Bitmap image = new Bitmap(Clipboard.GetImage());
s.Application.Activate();
var p = s.Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteDefault, Microsoft.Office.Core.MsoTriState.msoFalse, "", 0, "", Microsoft.Office.Core.MsoTriState.msoFalse);
Upvotes: 2
Views: 253
Reputation: 77
I found the reason after investigating for hours. It seems what I copied into clipboard should be enhancedmetapicture instead of a bitmap. So I changed my range copying excel part picture type from xlBitmap to xlPicture and then it worked.
Upvotes: 2