Subj.
This code falls on assigning Name property:
XLSNamedRegion := XLS.InternalNames.Add;
XLSNamedRegion.BuiltInName := bnNone;
XLSNamedRegion.Name := 'MyCoolNamedRange';
XLSNamedRegion.Col1 := 0;
XLSNamedRegion.Col2 := 10;
XLSNamedRegion.Row1 := 0;
XLSNamedRegion.Row2 := 10;
How add new NamedRange?
Re: How add new NamedRange?
I'm trying this as well, did you get it to work?
NameArea1 := xls.InternalNames.Add;
NameArea1.BuiltInName := bnNone;
NameArea1.NameName := 'PerformanceDay';
NameArea1.Comment := 'Comment - Day Performance';
NameArea1.Definition := 'ProfitCentrePerf!$B$2:$AH$8';
The result in excel is an invalid area....
Name = 'erform'
Value=#N/A
Refers to= #N/A
Delphi XE with XLSReadWriteII 4.00.53
NameArea1 := xls.InternalNames.Add;
NameArea1.BuiltInName := bnNone;
NameArea1.NameName := 'PerformanceDay';
NameArea1.Comment := 'Comment - Day Performance';
NameArea1.Definition := 'ProfitCentrePerf!$B$2:$AH$8';
The result in excel is an invalid area....
Name = 'erform'
Value=#N/A
Refers to= #N/A
Delphi XE with XLSReadWriteII 4.00.53
Re: How add new NamedRange?
Hello
When you create a name you must specify the area in the Definition property. It's also importand that cells in the definition are absolute.
When you create a name you must specify the area in the Definition property. It's also importand that cells in the definition are absolute.
Code: Select all
var
XLSNamedRegion: TInternalName;
begin
XLSNamedRegion := XLSBook.XLS.InternalNames.Add;
XLSNamedRegion.Name := 'MyCoolNamedRange';
XLSNamedRegion.Definition := 'Sheet1!$A$2:$B$8';
Lars Arvidsson, Axolot Data