Hello,

use the DisplayAlerts property:

...
XLApp.DisplayAlerts := False;
XLApp.Workbooks[1].SaveAs(XlsFileName);

With best regards, Mike Shkolnik
EMail: [EMAIL PROTECTED]
http://www.scalabium.com

--- kiran delphi <[EMAIL PROTECTED]> wrote:

> Hi all,
>    
>   Can any one help me on this please......I have a
> query regarding saving an Excel file from Delphi.I
> have a  existing Excel file .From Delphi I open this
> Excel file and wirting into it.
>    
>   While saving the Excel file it will dislplay a
> confirm dialog box with a message text   " A
> filename  c:\book1.xls already exists in this
> location .Do you want to replace it ?"
>   How can i overwrite/save  this file from delphi
> with out a confirm dialog box displayed....Please
> help me .
>   Please see the code below.....
>    
>    
>   Var
>   XLApp: Olevariant;
>     XlsFileName : string;    
>       Sheet Variant;
>  
>   
>   XlsFileName :='c:\book1.xls';
>       XLApp := CreateOleObject('Excel.Application');
>     XLApp.Visible :=false;
>       XLApp.Workbooks.Open(XlsFileName);  
>   Sheet := XLApp.Workbooks[1].Worksheets[1];  
>     
>         XLApp.Cells[2,1].value   :='Computer' ;
>          Sheet.Cells[2,2]   :='systems' ;     
>         XLApp.Workbooks[1].saveas(XlsFileName);
>    
>    
>   Thanks in advance 
>   Kiran Kumar


With best regards, Mike Shkolnik
EMail: [EMAIL PROTECTED]
http://www.scalabium.com


       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469

Reply via email to