C# - This operation cannot be performed in this event handler.

Posted on 2009-02-11
Last Modified: 2013-12-17
I am getting this error:
Presentation (unknown member) : Invalid request.  This operation cannot be performed in this event handler.

I am trying to close an instance of power point from within an add-in.

Basically I open another file by launching internet explorer and providing a ulr that points to another powerpoint presentation.  This works well.

After I do that I just want to close the program that I am in, but I get the error.

Even without opening the other file, how can I just shutdown powerpoint from an add-in, that is my real problem.

        void Application_PresentationOpen(Microsoft.Office.Interop.PowerPoint.Presentation Pres)
                            Process.Start("IExplore.exe", rnetlocation);
Question by:jackjohnson44
    1 Comment
    LVL 96

    Accepted Solution

    Hmmm...sounds like you are trying to close the presentation in the PresentationOpen event.  While I don't know the specific answer, I would think that you might try to close the presentation that is pass in as an argument.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now