I have created a C# Windows application in .NET 3.5, it runs the powerpoint slideshow and closes all the existing slideshows and should only run the new .ppt application.

In C# when I run this application with putting breakpoints it runs fine and gives no error.
But when I run it without breakpoint and say Ctrl+F5 then it throws the exception

Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 800706ba.

I have followed these links

http://blogs.msdn.com/karthick/archive/2006/02/28/540780.aspx


But got no help.

Can please anybody help me?

Thanks in advance,

Dani AI

Generated

Short note about the error and what helped here. The HRESULT 0x800706BA maps to an RPC "server unavailable" condition and commonly appears when the Office COM server (PowerPoint) is not ready or is unreachable. It often succeeds under the debugger because breakpoints slow execution. correctly called out a timing issue, and confirmed that Thread.Sleep made the failure go away. Thread.Sleep can work as a quick workaround, but a small retry loop with controlled backoff and proper COM cleanup is more robust and safer.

A suggested pattern: try creating the PowerPoint.Application with a few short retries, then proceed only when the object is usable. Release COM objects explicitly when finished.

// example pattern (requires Microsoft.Office.Interop.PowerPoint)
PowerPoint.Application pptApp = null;
int tries = 0, maxTries = 10;
while (pptApp == null && tries++ < maxTries)
{
    try { pptApp = new PowerPoint.Application(); }
    catch (System.Runtime.InteropServices.COMException) { Thread.Sleep(500); }
}
if (pptApp == null) throw new InvalidOperationException("Could not start PowerPoint.");

pptApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
// ... work with presentations ...

// cleanup
pptApp.Quit();
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(pptApp);
pptApp = null;
GC.Collect();
GC.WaitForPendingFinalizers();

Cautions: do not automate Office from services or IIS (Microsoft does not support server-side Office automation). If retries do not help, check whether PowerPoint is installed, whether the process runs in an interactive session, and whether DCOM/firewall or user-permission issues could block RPC.

Recommended Answers

All 2 Replies

Then it sounds like a timing issue.
You probably need to go give the object time to start before sending it instructions

Then it sounds like a timing issue.
You probably need to go give the object time to start before sending it instructions

Thanks the problem is solved by
Threading .Sleep

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.