473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Disable message when editing an Excel document programmically

Hello,

How can I disable that message/question that appears when my program edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to save
changes you made to <filename>?"

Any ideas?

Thanks,

David
Feb 14 '07 #1
6 11596
you can't write C# in Excel can you?

On Feb 13, 10:38 pm, David <D...@discussions.microsoft.comwrote:
Hello,

How can I disable that message/question that appears when my program edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to save
changes you made to <filename>?"

Any ideas?

Thanks,

David

Feb 14 '07 #2
and I believe that there is an optional parameter to the close method
that says 'save changes' or prompt to save changes.

if you open up Excel, and you go.. Tools, Visual C# Editor.

OH WAIT A SECOND, C# IS FOR FUCKING FAGS AND DOESNT WORK WITH MS
OFFICE DOES IT??

On Feb 13, 10:38 pm, David <D...@discussions.microsoft.comwrote:
Hello,

How can I disable that message/question that appears when my program edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to save
changes you made to <filename>?"

Any ideas?

Thanks,

David

Feb 14 '07 #3
Try this:

excelApp.DisplayAlerts = False
excelApp.Workbooks.Close()
excelApp.DisplayAlerts = True

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
"David" <Da***@discussions.microsoft.comwrote in message
news:1B**********************************@microsof t.com...
Hello,

How can I disable that message/question that appears when my program
edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0,
false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to
save
changes you made to <filename>?"

Any ideas?

Thanks,

David


Feb 14 '07 #4
That removed the message thanks, but now my Excel document does not contain
any of the edits that my program made.

Is there anything more you can suggest?
Thank,

David
"RobinS" wrote:
Try this:

excelApp.DisplayAlerts = False
excelApp.Workbooks.Close()
excelApp.DisplayAlerts = True

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
"David" <Da***@discussions.microsoft.comwrote in message
news:1B**********************************@microsof t.com...
Hello,

How can I disable that message/question that appears when my program
edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0,
false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to
save
changes you made to <filename>?"

Any ideas?

Thanks,

David


Feb 16 '07 #5
save your spreadsheet you fucking retard

On Feb 15, 10:38 pm, David <D...@discussions.microsoft.comwrote:
That removed the message thanks, but now my Excel document does not contain
any of the edits that my program made.

Is there anything more you can suggest?
Thank,

David

"RobinS" wrote:
Try this:
excelApp.DisplayAlerts = False
excelApp.Workbooks.Close()
excelApp.DisplayAlerts = True
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
"David" <D...@discussions.microsoft.comwrote in message
news:1B**********************************@microsof t.com...
Hello,
How can I disable that message/question that appears when my program
edits
an Excel file?
Here's the code:
Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0,
false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();
The question that appears (from Excel) is the following "Do you want to
save
changes you made to <filename>?"
Any ideas?
Thanks,
David- Hide quoted text -

- Show quoted text -

Feb 16 '07 #6
Did you save the Excel workbook before closing it?

Robin S.
---------------------------------------
"David" <Da***@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.com...
That removed the message thanks, but now my Excel document does not
contain
any of the edits that my program made.

Is there anything more you can suggest?
Thank,

David
"RobinS" wrote:
>Try this:

excelApp.DisplayAlerts = False
excelApp.Workbooks.Close()
excelApp.DisplayAlerts = True

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
"David" <Da***@discussions.microsoft.comwrote in message
news:1B**********************************@microso ft.com...
Hello,

How can I disable that message/question that appears when my program
edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0,
false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0,
true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want
to
save
changes you made to <filename>?"

Any ideas?

Thanks,

David




Feb 17 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
0
by: volume | last post by:
Hi all, In an effort to try to impress the boss, I would like to log accounting information to an Excel spreadsheet using C# and .NET. This would be a mockup only, not a real solution - yet! We...
2
by: Amy B | last post by:
Hi, I've been trying to figure out how to fix this for several days but nothing I have done so far seems to work. I have posted this message in a Google Excel Programming group, but did not...
1
by: Bon | last post by:
Hello all I create a form with three buttons in MS Access 2000. They are Open Excel Template, Save Draft and Save Final. When I click the Open Excel Template button, the Excel template will be...
2
by: wubin_98 | last post by:
Hi, I want to export a gridview data and a image from image control to export to an Excel document. When I executed following code, GridView data was exported to Excel properly. But no image...
0
by: Jono | last post by:
Hello, I've been getting this message when closing excel (not necessarily when closing the workbook by itself, but when closing Excel and the workbook at the same time): ...
8
by: K Viltersten | last post by:
I understand that the new versions of MS Word, MS Excel etc. allow for creation of a document using XML tags (the technique or format is called OOXML, i think). I imagine that the idea behind...
4
by: stephen | last post by:
Hi all, I am working with Excel. I read an excel document using ExcelReader and lets say it has 10 columns. I have to read each record and based on a specified column peform some activites and...
6
by: ronparker | last post by:
Hello, This is my first time posting and just my second day using python on mysql, so please be patient with me. I should also say, I am using a linux machine. Using python I was able to make a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.