Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Closing, Saving question

Hello,

I really hope I am right here. I am programming an excel client in c#, and I
try to start excel with an empty workbook and then save it with a given
filepath.
Empty workbook seems ok:
object missing = System.Reflection.Missing.Value;

appExcel.Visible = true;

wb = (Workbook)appExcel.Workbooks.Add(missing);

However, when I try to Close(...) or SaveAs(...), excel allways comes up
with the messagebox if I want to override the existing file.

Example:

wb.Close(true,"d:\\Excelsheet.xls",false);

appExcel.Workbooks.Close();

appExcel.Quit();



My question: How can I prevent excel from displaying the messagebox, and
save the file in any case ?

Weired, in the case above, if I answer the messagebox with "no", I get an
exception on the wb.Close() call.



Thank you for any hints

Fritz


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Closing, Saving question

In VBA, you can use

WB.Close SaveChanges:= True

Is there something in c# that's similar?

"Fritz Hilgemann" wrote:

Hello,

I really hope I am right here. I am programming an excel client in c#, and I
try to start excel with an empty workbook and then save it with a given
filepath.
Empty workbook seems ok:
object missing = System.Reflection.Missing.Value;

appExcel.Visible = true;

wb = (Workbook)appExcel.Workbooks.Add(missing);

However, when I try to Close(...) or SaveAs(...), excel allways comes up
with the messagebox if I want to override the existing file.

Example:

wb.Close(true,"d:\\Excelsheet.xls",false);

appExcel.Workbooks.Close();

appExcel.Quit();



My question: How can I prevent excel from displaying the messagebox, and
save the file in any case ?

Weired, in the case above, if I answer the messagebox with "no", I get an
exception on the wb.Close() call.



Thank you for any hints

Fritz



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Closing, Saving question

Yes, but appearently it does not prevent the messagebox. In the code line
wb.Close(true,"d:\\Excelsheet.xls",false); (see orig. message)
the first parameter is named "SaveChanges".

Fritz

"Barb Reinhardt" wrote in message
...
In VBA, you can use

WB.Close SaveChanges:= True

Is there something in c# that's similar?

"Fritz Hilgemann" wrote:

Hello,

I really hope I am right here. I am programming an excel client in c#,
and I
try to start excel with an empty workbook and then save it with a given
filepath.
Empty workbook seems ok:
object missing = System.Reflection.Missing.Value;

appExcel.Visible = true;

wb = (Workbook)appExcel.Workbooks.Add(missing);

However, when I try to Close(...) or SaveAs(...), excel allways comes up
with the messagebox if I want to override the existing file.

Example:

wb.Close(true,"d:\\Excelsheet.xls",false);

appExcel.Workbooks.Close();

appExcel.Quit();



My question: How can I prevent excel from displaying the messagebox, and
save the file in any case ?

Weired, in the case above, if I answer the messagebox with "no", I get an
exception on the wb.Close() call.



Thank you for any hints

Fritz





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Closing, Saving question

Uuh, I just got it, although it is a little weired:
appExl.DisplayAlerts = false;

Thanks anyway!
Fritz

"Fritz Hilgemann" wrote in message
...
Yes, but appearently it does not prevent the messagebox. In the code line
wb.Close(true,"d:\\Excelsheet.xls",false); (see orig. message)
the first parameter is named "SaveChanges".

Fritz

"Barb Reinhardt" wrote in
message ...
In VBA, you can use

WB.Close SaveChanges:= True

Is there something in c# that's similar?

"Fritz Hilgemann" wrote:

Hello,

I really hope I am right here. I am programming an excel client in c#,
and I
try to start excel with an empty workbook and then save it with a given
filepath.
Empty workbook seems ok:
object missing = System.Reflection.Missing.Value;

appExcel.Visible = true;

wb = (Workbook)appExcel.Workbooks.Add(missing);

However, when I try to Close(...) or SaveAs(...), excel allways comes up
with the messagebox if I want to override the existing file.

Example:

wb.Close(true,"d:\\Excelsheet.xls",false);

appExcel.Workbooks.Close();

appExcel.Quit();



My question: How can I prevent excel from displaying the messagebox, and
save the file in any case ?

Weired, in the case above, if I answer the messagebox with "no", I get
an
exception on the wb.Close() call.



Thank you for any hints

Fritz







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving and Closing erf Excel Worksheet Functions 3 June 18th 08 05:03 PM
Saving and Closing erf Excel Discussion (Misc queries) 1 June 18th 08 08:38 AM
Prompting user to answer a question before saving and closing wkbo JustBreathe Excel Programming 5 March 8th 07 10:55 PM
closing & saving rufusf Excel Worksheet Functions 2 March 5th 06 09:37 AM
VBA - closing without saving changes ajliaks[_14_] Excel Programming 2 April 21st 04 09:28 PM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"