Click here to Skip to main content
11,921,353 members (59,740 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


12 bookmarked

Opening and Navigating Excel with C# - Removing dialogs

, 26 Mar 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Remove dialogs


Take a look at the article below first. The only thing I'm adding here is how to remove dialogs... since I couldn't find that anywhere online.


Error: The problem is that every time I run it, a message box comes up saying: "'example.xls' is being modified by johndoe. Open as read-only?"


Before opening the Excel file, run this code:

excelApp.DisplayAlerts = false;

So, the entire code would look like this:

Microsoft.Office.Interop.Excel.Workbook workbook;

Microsoft.Office.Interop.Excel.ApplicationClass excelApp = 
          new Microsoft.Office.Interop.Excel.ApplicationClass();

excelApp.DisplayAlerts = false;

workbook = excelApp.Workbooks.Open(   
    ReadOnly, 5, Type.Missing, Type.Missing, true,
    ExcelLib.XlPlatform.xlWindows, Type.Missing, 
    true, false, Type.Missing, false, false,

And that's all I wanted to add. (Note, the linked article isn't allowing me to post, otherwise I'd have thrown a message up there on it.)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
United States United States
likes boardgames, computer games, and enjoys his .net programming job.

You may also be interested in...

Comments and Discussions

GeneralReason you couldn't post a message to the linked article Pin
Kent K31-Mar-09 9:09
memberKent K31-Mar-09 9:09 
. . .I think was probably just the URL you came into it with. . .you probably found it by a yahoo or google search?

You get a different view sometimes with arrivals via search engines. If you search for that article at codeproject you will get this url, a different one but one that you could post a message to. Opening and Navigating Excel with C#[^]

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151120.1 | Last Updated 26 Mar 2009
Article Copyright 2009 by ColinBashBash
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid