PC Review


Reply
Thread Tools Rate Thread

Disable message when editing an Excel document programmically

 
 
=?Utf-8?B?RGF2aWQ=?=
Guest
Posts: n/a
 
      14th Feb 2007
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


 
Reply With Quote
 
 
 
 
aaron.kempf@gmail.com
Guest
Posts: n/a
 
      14th Feb 2007
you can't write C# in Excel can you?

On Feb 13, 10:38 pm, David <D...@discussions.microsoft.com> wrote:
> 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



 
Reply With Quote
 
aaron.kempf@gmail.com
Guest
Posts: n/a
 
      14th Feb 2007
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 ****ING FAGS AND DOESNT WORK WITH MS
OFFICE DOES IT??





On Feb 13, 10:38 pm, David <D...@discussions.microsoft.com> wrote:
> 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



 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      14th Feb 2007
Try this:

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

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
----------------------------------------------------------
"David" <(E-Mail Removed)> wrote in message
news:1BEEBE43-861F-4859-BCC9-(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
=?Utf-8?B?RGF2aWQ=?=
Guest
Posts: n/a
 
      16th Feb 2007
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" <(E-Mail Removed)> wrote in message
> news:1BEEBE43-861F-4859-BCC9-(E-Mail Removed)...
> > 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
> >
> >

>
>
>

 
Reply With Quote
 
pfc_sadr@hotmail.com
Guest
Posts: n/a
 
      16th Feb 2007
save your spreadsheet you ****ing retard





On Feb 15, 10:38 pm, David <D...@discussions.microsoft.com> wrote:
> 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.com> wrote in message
> >news:1BEEBE43-861F-4859-BCC9-(E-Mail Removed)...
> > > 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 -



 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      17th Feb 2007
Did you save the Excel workbook before closing it?

Robin S.
---------------------------------------
"David" <(E-Mail Removed)> wrote in message
news:6BD3C4B1-40C9-4FA8-9FE0-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:1BEEBE43-861F-4859-BCC9-(E-Mail Removed)...
>> > 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
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable users from editing an excel sheet once they open =?Utf-8?B?UGlldHJv?= Microsoft Excel Misc 0 29th Sep 2007 02:26 PM
Excel document locked for editing? =?Utf-8?B?S3Jpc3Rpbl9XYWRl?= Microsoft Excel Misc 0 31st Aug 2006 05:50 PM
excel document locked for editing =?Utf-8?B?a3Jpc2g=?= Microsoft Excel Setup 3 16th Nov 2005 08:17 PM
Programmically Outputting a Report as a Word Document Jeff Harbin Microsoft Access Reports 1 8th Jan 2005 11:55 PM
enable / disable text boxes programmically =?Utf-8?B?TGxveWQ=?= Microsoft C# .NET 6 18th May 2004 12:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 AM.