C# + Late Binding (Excel) - Save File

Posted on 2009-04-30
Last Modified: 2013-12-17
I have tried to update excel using C# and late and message prompt when program excuting the "Save" function

objBook.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod, null, objBook, Parameters);

may I know is there any method to disable this alert? or make allow autosave?

Question by:hoikar
    LVL 2

    Expert Comment

    You need to set DisplayAlerts property of your Excel object as False, and it will suppress the alert.
    Suppose your declared excel object is objExcel then code would be

    objExcel.DisplayAlerts = false;


    Author Comment

    To Rakesh_Desai:

    How to set in C# with the late binding?
    Could you please provide me one example?

    Many Thanks~
    LVL 2

    Accepted Solution

    Should go this way:
    suppose your excel object name is objExcel
    objExcel.GetType().InvokeMember("DisplayAlerts", BindingFlags.SetProperty, null, objExcel, new object[] { false });

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
    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…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    758 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

    13 Experts available now in Live!

    Get 1:1 Help Now