none
Typelib is used in the office2010 environment and the ppt file is open. RRS feed

  • Question

  • hello!

    [Development setting]
     Windows Vista Business SP2
     Visual Studio 2008 SP1
     Office 2010

    [Situation]
    1)Dialog base application making of MFC
    2)CApplication, CPresentation, and CPresentations of PowerPoint2010 are added with Typelib.
    3)Include is done, and CApplication app;It defines and it compiles solving.

    ->The error occurs.

    4)# import line of CApplication.h ends comment and is compiled.

    ->The error disappears.

    5)The following code is added and it compiles.
     CApplication app;
     CoInitialize(NULL);
     app.CreateDispatch(_T("PowerPoint.Application"));

     CPresentations pres = app.get_Presentations();
     try{
      pres.Open(_T("d:\\OfficeData.ppt"), FALSE, FALSE, FALSE);
     }
     catch(CException *e)
     {
      e->Delete();
     }
     pres.ReleaseDispatch();
     app.ReleaseDispatch();
     CoUninitialize();

    ->
    It succeeds in Open of the ppt file in the Office2000-2003 installation environment.
    It fails in Open in the Office2010 installation environment.
    Please advise when doing very to do Open with Office2010 ..good...

    Monday, March 19, 2012 2:59 PM

Answers

  • Hi Chris,

    Hi Tom,

    Thank you for advice.

    It solved it.

    It is confirmed to do open by clear OS and reinstalling Office.

    It has been understood to fail in open if the pattern of the installation is not variously tested or "Visual Basic for Applications" is not installed by the inquiry etc.

    In the environment not moved, it seems that only PowerPoint was installed when Office is installed.

    • Marked as answer by tsus_1877 Thursday, March 29, 2012 4:00 AM
    Thursday, March 29, 2012 4:00 AM

All replies

  • Hi tsus_1877,

    Thanks for posting in the MSDN Forum.

    Would you please tell me your platform is 32-bit or 64-bit?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, March 21, 2012 6:20 AM
    Moderator
  • Hi Tom_Xu MSFT,

    my platform is 32-bit.

    exception error string : null(0x80004005)

    pres.Open(_T("d:\\OfficeData.pptx"), FALSE, FALSE, FALSE);
    ppt file and pptx file -> Exception


    • Edited by tsus_1877 Thursday, March 22, 2012 12:13 AM
    Wednesday, March 21, 2012 6:37 AM
  • Hi tsus_1877,

    OK, I think I must involve some experts into this thread to help you. There might be some time dely. Thanks for you patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, March 22, 2012 6:30 AM
    Moderator
  • Hi tsus_1877,

    The error code you receive is "unspecified error" and is returned from many calls involving many products, all involving COM. For that reason it is not possible to be specific about why your call to presentation.Open(... returns that error.

    Your code doesn't change from one version to another of PowerPoint, and is appropriate for PowerPoint 2007 and PowerPoint 2010, both for .ppt and .pptx presentations.

    Here are some things to consider:
    Be sure the path to the file is correct.
    Be sure the presentation is not open.
    Be sure the presentation is not ReadOnly.
    If the presentation has macros the path should include the extension .pptm.

    The Visual Studio project should have a reference on the COM tab to the appropriate version of Office and to the appropriate version of PowerPoint.  

    Here is a link to MSDN content about error handling in COM:

    Error Handling in COM (Windows) - MSDN – Explore Windows, Web ...
    http://msdn.microsoft.com/en-us/library/ff485842(v=VS.85).aspx

    Please let us know how the information above helps you to resolve the issue.
    Regards,
    Chris Jensen
    Senior Technical Support Lead

    Chris Jensen

    Wednesday, March 28, 2012 5:42 PM
    Moderator
  • Hi Chris,

    Hi Tom,

    Thank you for advice.

    It solved it.

    It is confirmed to do open by clear OS and reinstalling Office.

    It has been understood to fail in open if the pattern of the installation is not variously tested or "Visual Basic for Applications" is not installed by the inquiry etc.

    In the environment not moved, it seems that only PowerPoint was installed when Office is installed.

    • Marked as answer by tsus_1877 Thursday, March 29, 2012 4:00 AM
    Thursday, March 29, 2012 4:00 AM