[Last Call] Learn how to a build a cloud-first strategyRegister Now


C# + Late Binding (Excel) - Save File

Posted on 2009-04-30
Medium Priority
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
  • 2

Expert Comment

ID: 24283050
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

ID: 24284912
To Rakesh_Desai:

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

Many Thanks~

Accepted Solution

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

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

830 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