Highlighted
Honored Contributor.
Honored Contributor.
1363 views

Excel: Workbook.Names.Add

Jump to solution

Hello,

i have the next problem with Excel to give a cell a name.

Excel Macro looks like this:
ActiveWorkbook.Names.Add Name:="David", RefersToR1C1:= _ "='Table 1'!R1C1"

I tested several spellings to get it to work and i am atm at this point:
modify xls-book @Names::@Add ( "David", "='Table 1'!$A$1" ).
This is the only spelling which is accepted from Excel without an Error.

But in Excel i get i reference to Cell:
='Table 1'!#REF

When i set a Range before and use it to set the Cell:
inquire xls-sheet @CELLS::@ITEM(1, "A") xls-range.
modify xls-book @Names::@Add ("David", xls-range ).

Then i get also in Excel the reference to the Cell:
='Table 1'#REF

When i use the R1C1-Spelling i get a Formula Error from Excel.

Can anyone give some advice?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Honored Contributor.
Honored Contributor.

RE: Excel: Workbook.Names.Add

Jump to solution

my mistake... the code works. I added it in our excel-test program and the row is later from another code modfied and destroys the name.

View solution in original post

0 Likes
1 Reply
Highlighted
Honored Contributor.
Honored Contributor.

RE: Excel: Workbook.Names.Add

Jump to solution

my mistake... the code works. I added it in our excel-test program and the row is later from another code modfied and destroys the name.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.