Share via


Unable to cast COM object of type 'Microsoft.Office.Interop.PowerPoint.ApplicationClass' to interface type 'Microsoft.Office.Interop.PowerPoint._Application

Question

Monday, August 5, 2013 9:55 AM

I am using following code to open a ppt file

   Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();

                //open powerpoint document
                pptPresentation = pptApplication.Presentations.Open((string)originalPptPath,
                                                                    Microsoft.Office.Core.MsoTriState.msoFalse,
                                                                    Microsoft.Office.Core.MsoTriState.msoFalse,
                                                                    Microsoft.Office.Core.MsoTriState.msoFalse);

The problem is it is giving following exception

System.InvalidCastException was unhandled
  Message=Unable to cast COM object of type 'Microsoft.Office.Interop.PowerPoint.ApplicationClass' to interface type 'Microsoft.Office.Interop.PowerPoint._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{91493442-5A91-11CF-8700-00AA0060263B}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
  Source=Microsoft.Office.Interop.PowerPoint

What could be the reason, please suggest

Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin

All replies (2)

Tuesday, August 6, 2013 5:33 AM âś…Answered | 1 vote

I have resolved the issue, the detailed steps i have posted here

http://social.technet.microsoft.com/wiki/contents/articles/18919.c-ppt-to-pdf-unable-to-cast-com-object-of-type-microsoft-office-interop-powerpoint-applicationclass-to-interface-type-microsoft-office-interop-powerpoint-application.aspx

Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin


Tuesday, August 6, 2013 8:40 AM

Glad to see this issue has been resolved and thank you for sharing your solutions here.

Have a nice day,

Jack Zhai [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.