Board index » delphi » Excel 97 : Adding Names in sheet

Excel 97 : Adding Names in sheet

FYI : for adding names in an Excel sheet, the code may be sth like :

aWorkBook.Names(aName, aReference, EmptyParam [9 times]) ;

where :

aName = the pascal string representing the name ;
aReference = sth like '=aSheet!$A$23'

The thing is, THE "$" SIGNS MUST BE USED else the call does not work
properly (no crash, but : wrong cell reference, name is not visible, =aName
does not yield the expected value...).

This is not documented in the Excel 97 language reference (MS press). I do
not know if it is a VBA quirk (or bug), or if Excel97.pas is the culprit,
but at least it works like this.

Note do Deborah Pate : please feel free to add that to your Excel Automation
webpage, if you think it relevant.

 

Re:Excel 97 : Adding Names in sheet


<<Airy Magnien:
Note do Deborah Pate : please feel free to add that to
your Excel Automation webpage, if you think it relevant.

Quote

Thanks Airy - suggestions always welcome. :)

Deborah Pate

Re:Excel 97 : Adding Names in sheet


Airy Magnien skrev i meldingen <850tb3$p...@bornews.borland.com>...

Quote
>FYI : for adding names in an Excel sheet, the code may be sth like :

>aWorkBook.Names(aName, aReference, EmptyParam [9 times]) ;

>where :

>aName = the pascal string representing the name ;
>aReference = sth like '=aSheet!$A$23'

>The thing is, THE "$" SIGNS MUST BE USED else the call does not work
>properly (no crash, but : wrong cell reference, name is not visible, =aName
>does not yield the expected value...).

>This is not documented in the Excel 97 language reference (MS press). I do
>not know if it is a VBA quirk (or bug), or if Excel97.pas is the culprit,
>but at least it works like this.

Just FYI: I had a customer who didn't like this referencing style, and I did
a simple Replace(What:='$',Replacement:=''); after the formulas were written.
Voila ! everything's just fine....

--
Bjoerge Saether
Consultant / Developer
Asker, Norway
bsaether.removet...@online.no (remove the obvious)

Other Threads