Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I try to run the code in debug mode I get following error ..any suggestion how can i take care of it? thanks

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: Interface not registered (Exception from HRESULT: 0x80040155).
Posted
Updated 3-Nov-11 20:43pm
v2

Invalid reference or reference to some unregistered assembly can cause it. Check if you are referencing correct version of Office Interop.
 
Share this answer
 
which line gives you error can you post it ?
 
Share this answer
 
Comments
EricThe 4-Nov-11 3:50am    
this is the line

ApplicationClass pptApplication = new ApplicationClass();
Presentation pptPresentation = pptApplication.Presentations.Open("bigstory.ppt", MsoTriState.msoFalse,
MsoTriState.msoFalse, MsoTriState.msoFalse);
Use following code, it might help you.

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

Presentation pptPresentation = pptApplication.Presentations.Open("bigstory.ppt", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
 
Share this answer
 
Comments
EricThe 4-Nov-11 12:33pm    
thanks for the code, that error went away but now this comes up
Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Do a repair on your office installation. I think.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900