PowerPoint Shapes.AddOLEObject Throws Error HRESULT E_FAIL





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Following the guidelines from this link, I've wrapped a user control as an ActiveX component. Build the code successfully, and I can confirm that the COM component is registered in Windows registry.



Class name mentioned in registry is "MyChartsControl.UserControl1".



After that I try to add my ActiveX Wrapped user control in PowerPoint Slide object using following code:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="MeridiaChartsControl.UserControl1")


OR using the ProgId:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="ActiveXTestLibrary.UserControl")


The code throws the exception given below:



Error HRESULT E_FAIL has been returned from a call to a COM component.


Though following code works fine on same slide object if I add picture:



powerpointSlideObject.Shapes.AddPicture("d:\temp\image1.png", MsoTriState.msoFalse, MsoTriState.msoCTrue, 400, 150)


Any solution or workaround would be highly appreciated.










share|improve this question























  • E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

    – Hans Passant
    Nov 23 '18 at 16:29













  • I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

    – TnTinMn
    Nov 23 '18 at 20:20


















0















Following the guidelines from this link, I've wrapped a user control as an ActiveX component. Build the code successfully, and I can confirm that the COM component is registered in Windows registry.



Class name mentioned in registry is "MyChartsControl.UserControl1".



After that I try to add my ActiveX Wrapped user control in PowerPoint Slide object using following code:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="MeridiaChartsControl.UserControl1")


OR using the ProgId:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="ActiveXTestLibrary.UserControl")


The code throws the exception given below:



Error HRESULT E_FAIL has been returned from a call to a COM component.


Though following code works fine on same slide object if I add picture:



powerpointSlideObject.Shapes.AddPicture("d:\temp\image1.png", MsoTriState.msoFalse, MsoTriState.msoCTrue, 400, 150)


Any solution or workaround would be highly appreciated.










share|improve this question























  • E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

    – Hans Passant
    Nov 23 '18 at 16:29













  • I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

    – TnTinMn
    Nov 23 '18 at 20:20














0












0








0








Following the guidelines from this link, I've wrapped a user control as an ActiveX component. Build the code successfully, and I can confirm that the COM component is registered in Windows registry.



Class name mentioned in registry is "MyChartsControl.UserControl1".



After that I try to add my ActiveX Wrapped user control in PowerPoint Slide object using following code:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="MeridiaChartsControl.UserControl1")


OR using the ProgId:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="ActiveXTestLibrary.UserControl")


The code throws the exception given below:



Error HRESULT E_FAIL has been returned from a call to a COM component.


Though following code works fine on same slide object if I add picture:



powerpointSlideObject.Shapes.AddPicture("d:\temp\image1.png", MsoTriState.msoFalse, MsoTriState.msoCTrue, 400, 150)


Any solution or workaround would be highly appreciated.










share|improve this question














Following the guidelines from this link, I've wrapped a user control as an ActiveX component. Build the code successfully, and I can confirm that the COM component is registered in Windows registry.



Class name mentioned in registry is "MyChartsControl.UserControl1".



After that I try to add my ActiveX Wrapped user control in PowerPoint Slide object using following code:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="MeridiaChartsControl.UserControl1")


OR using the ProgId:



powerpointSlideObject.Shapes.AddOLEObject(100, 100, 111, 222, ClassName:="ActiveXTestLibrary.UserControl")


The code throws the exception given below:



Error HRESULT E_FAIL has been returned from a call to a COM component.


Though following code works fine on same slide object if I add picture:



powerpointSlideObject.Shapes.AddPicture("d:\temp\image1.png", MsoTriState.msoFalse, MsoTriState.msoCTrue, 400, 150)


Any solution or workaround would be highly appreciated.







c# vb.net office-interop powerpoint-vba office-addins






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 16:19









Azaz ul HaqAzaz ul Haq

6271926




6271926













  • E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

    – Hans Passant
    Nov 23 '18 at 16:29













  • I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

    – TnTinMn
    Nov 23 '18 at 20:20



















  • E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

    – Hans Passant
    Nov 23 '18 at 16:29













  • I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

    – TnTinMn
    Nov 23 '18 at 20:20

















E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

– Hans Passant
Nov 23 '18 at 16:29







E_FAIL is a teacher's grade for the quality of the error reporting. At some point PowerPoint just stops trying to guess what you're trying to do and throws up its hands. UserControl is not an OLE object. OLE is pretty dead in general and only survives in the Office object model. Mostly because they couldn't remove it without risking breaking old projects. .NET made no attempt to implement it.

– Hans Passant
Nov 23 '18 at 16:29















I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

– TnTinMn
Nov 23 '18 at 20:20





I seem to remember that when doing something similar, but for Excel and using Microsoft InteropForms Toolkit 2.1, that it is important to not use the AnyCPU platform and instead either use x86 or x64.

– TnTinMn
Nov 23 '18 at 20:20












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450008%2fpowerpoint-shapes-addoleobject-throws-error-hresult-e-fail%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450008%2fpowerpoint-shapes-addoleobject-throws-error-hresult-e-fail%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini