I am getting the error:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80080005.
for line PowerPoint.Application PowerPoint_App = new PowerPoint.Application();
for this block of code here:
using (new Impersonator(Installs.Current.PPTUser, null, Installs.Current.PPTPassword))
{
PowerPoint.Application PowerPoint_App = new PowerPoint.Application();
PowerPoint.Presentation presentation = null;
try
{
PowerPoint_App.Visible = MsoTriState.msoTrue;
presentation = PowerPoint_App.Presentations.Open(
strPptFilePath, Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoTrue);
for (int i = 0; i < presentation.Slides.Count; i++)
{
readSlides(presentation, i);
}
presentation.Close();
PowerPoint_App.Quit();
}
catch (Exception ex)
{
strSuccess = ex.ToString();
MindMatrix.Libraries.Entities.ExceptionMessage.HandleException(ex, null);
}
finally
{
Marshal.FinalReleaseComObject(presentation);
Marshal.FinalReleaseComObject(PowerPoint_App);
}
}
whenever I run the code for the first time, it works perfectly, but then it creates process for PowerPoint (which can be seen in Task Manager). I have used PowerPoint_App.Quit();
to quit the already open process, but it's not working and throwing me error. I go to Task Manager and end process from there and then it's ready to work for one more time.
Am I doing something wrong while quitting the process from code or is there any other way to do it?