Hi,
Before writing the file you must delete it. You can use de delete method
and/or fileexist method like this:
if FileExists(XlsFileName) then
DeleteFile(XlsFileName);
Samuel Liuján
kiran delphi escribió:
>
> 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
> _____________________
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
>
> [Non-text portions of this message have been removed]
>
>
[Non-text portions of this message have been removed]