Board index » delphi » Update excel spreadsheet

Update excel spreadsheet


2005-10-16 11:01:13 PM
delphi18
Hi:
I need to update some excel spreadsheet from delphi (version 5). I need to
open a excel worksheet, put some data into a column,row and save this file.
For example: put 10.56 into colum C row 10, on sheet1.
Any help will be very appreciate.
Thank
Luis
 
 

Re:Update excel spreadsheet

var
xls, xlw: Variant;
begin
xls := CreateOleObject('Excel.Application');
try
xlw := xls.WorkBooks.Open(yourFileName);
xls.ActiveSheet.Cells[10, 3].Value := 10.56;
xlw.Save(yourFileName);
finally
xlw.Close;
xlw := UnAssigned;
xls.Quit;
xls := UnAssigned;
end
end;
"Luis Daniel Taballione" <XXXX@XXXXX.COM>writes
Quote
Hi:
I need to update some excel spreadsheet from delphi (version 5). I need to
open a excel worksheet, put some data into a column,row and save this
file.
For example: put 10.56 into colum C row 10, on sheet1.
Any help will be very appreciate.
Thank
Luis


 

Re:Update excel spreadsheet

Thanks Mike!
but this line
xlw.Save(yourFileName)
don't work with filename as parameter. Instead I will try whitout parameter
and work ok.
Thank againg
By the way, how I change the active page?
Regards
Luis
"Mike Shkolnik" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote
var
xls, xlw: Variant;
begin
xls := CreateOleObject('Excel.Application');
try
xlw := xls.WorkBooks.Open(yourFileName);
xls.ActiveSheet.Cells[10, 3].Value := 10.56;
xlw.Save(yourFileName);
finally
xlw.Close;
xlw := UnAssigned;
xls.Quit;
xls := UnAssigned;
end
end;
--
With best regards, Mike Shkolnik
EMail: XXXX@XXXXX.COM
www.scalabium.com

"Luis Daniel Taballione" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Hi:
>I need to update some excel spreadsheet from delphi (version 5). I need
>to
>open a excel worksheet, put some data into a column,row and save this
file.
>For example: put 10.56 into colum C row 10, on sheet1.
>Any help will be very appreciate.
>Thank
>Luis
>
>


 

Re:Update excel spreadsheet

Quote
By the way, how I change the active page?
xlw := xls.WorkBooks.Open(yourFileName);
xlw.Sheets.Item[i].Activate;
 

Re:Update excel spreadsheet

Thanks for your time
Luis
"Mike Shkolnik" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote
>By the way, how I change the active page?
xlw := xls.WorkBooks.Open(yourFileName);
xlw.Sheets.Item[i].Activate;

--
With best regards, Mike Shkolnik
EMail: XXXX@XXXXX.COM
www.scalabium.com