Page 1 of 1

Reference another spreadsheet in a formula

Posted: Mon Oct 26, 2009 4:52 pm
by Orionizer
Is it possible to reference another spreadsheet in a formula? I've tried the following code and all I get are zeroes (no formula) in sheet '2'...

var
NewSheet: TSheet;
X: Integer;
FormStr: String;

begin
XLSRWMain.Filename:='C:\Test.xlsx';
XLSRWMain.Sheets.Clear;
NewSheet:=XLSRWMain.Sheet[0];
NewSheet.Name:='1';
for X:=1 to 10 do
begin
NewSheet.AsInteger[0,X]:=X;
end;
NewSheet:=XLSRWMain.Sheets.Add(wtSheet);
NewSheet.Name:='2';
for X:=1 to 10 do
begin
FormStr:='SUM(''1''!A' + IntToStr(X) + '*2)';
NewSheet.AsFormula[0,X]:=FormStr;
end;
XLSRWMain.Write;
end;

I have inserted a Showmessage routine to show the value of FormStr before setting the formula value in the cell and everything looks correct, but my results in the sheet titled '2' are all zeroes...

Re: Reference another spreadsheet in a formula

Posted: Fri Oct 30, 2009 10:12 am
by larsa
Hello

This shall be fixed in the last update. Please download it and try again.

Re: Reference another spreadsheet in a formula

Posted: Tue Nov 03, 2009 12:19 pm
by Orionizer
Will do - thanks!