#1   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default xlfTextref

Am I missing something, or does xlfTextref from the C API not support
named ranges?

If I have a (possibly disjoint) range of cells named myRange, then the
Excel 4 macro command
=TEXTREF("myRange")
returns the range named by myRange, but the C command
Excel4(xlfTextref, &xArgRef, 1, TempStr(" myRange"));
returns xlretFailed.

Jerry

  #2   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default xlfTextref

"Jerry W. Lewis" wrote in message
...
Am I missing something, or does xlfTextref from the C API not support
named ranges?


You are missing xlfGetName. TEXTREF is for converting A1 or R1C1-style
strings into ref OPER's.

  #3   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default xlfTextref

If myRange is a named range refering to the union of B1:B3 and D1:D6,
then the Excel 4 macro statement
=TEXTREF("myRange")
returns "[xl4.xls]Sheet1!R1C4:R6C4,[xl4.xls]Sheet1!R1C2:R3C2" and
=GET.NAME("myRange")
returns "=[xl4.xls]Sheet1!R1C4:R6C4,[xl4.xls]Sheet1!R1C2:R3C2"

Neither syntax seems to work in the C API:
Excel4(xlfTextref, &xArgRef, 1, TempStr(" myRange"));
returns xlretFailed, and
Excel4(xlfGetName, &xArgRef, 1, TempStr(" myRange"));
returns xlretSuccess, but xArgRef contains a #NAME? error.

Still wondering if I am missing something or if the C API does not
support going determining the range defined to a name.

Jerry

Keith A. Lewis wrote:

"Jerry W. Lewis" wrote in message
...

Am I missing something, or does xlfTextref from the C API not support
named ranges?


You are missing xlfGetName. TEXTREF is for converting A1 or R1C1-style
strings into ref OPER's.


  #4   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default xlfTextref

Excel4(xlfGetName, &xArgRef, 1, TempStr(" myRange"));
returns xlretSuccess, but xArgRef contains a #NAME? error.

Still wondering if I am missing something or if the C API does not
support going determining the range defined to a name.


"""
Syntax

GET.NAME(name_text, info_type)
Name_text can be a name defined on the macro sheet; an external reference
to a name defined on the active workbook, for example, "!Sales"; or an
external reference to a name defined on a particular open workbook, for
example, "[Book1]SHEET1!Sales". Name_text can also be a hidden name.
"""

Defining myRange on the worksheet and calling the following worksheet
function with "!myRange" returns the range in R1C1 notation (its actually
Z1S1 in a German Excel).

[WorksheetFunction(DeferRecalculation=true)]
public static XlOper GetName(String name)
{
return Excel.Call(Excel.Functions.xlfGetName, name);
}


Jens.


--
Jens Thiel * Willy-Brandt-Allee 10 * D-53113 Bonn * +49 228 5400124
http://jens-thiel.de/ http://ManagedXLL.net/ http://QuantLib.net/


  #5   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default xlfTextref

Thank you, that works; but is apparently yet another example where the C
API Excel4() function works differently than the corresponding Excel 4
macro function. Are these differences documented anywhere, or must they
be discovered by trial and error?

In Excel 4, info_type is an optional argument, whose input values (as
implemented in Excel 2000 and Excel XP) are wrong in MACROFUN.HLP. The
C API function Excel4(xlfGetName) uses info_type as documented in
MACROFUN.HLP, rather than as implemented in Excel 4.

In Excel 4, GET.NAME accepts either "myRange" or "!myRange", and both
usages are sanctioned in the Examples from MACROFUN.HLP. The difference
is that the return with "!myRange" omits "[xl4.xls]Sheet1!". As you
pointed out, Excel4(xlfGetName) only accepts TempStr(" !myRange") and
not TempStr(" myRange")

Jerry

Jens Thiel wrote:

Excel4(xlfGetName, &xArgRef, 1, TempStr(" myRange"));
returns xlretSuccess, but xArgRef contains a #NAME? error.

Still wondering if I am missing something or if the C API does not
support going determining the range defined to a name.


"""
Syntax

GET.NAME(name_text, info_type)
Name_text can be a name defined on the macro sheet; an external reference
to a name defined on the active workbook, for example, "!Sales"; or an
external reference to a name defined on a particular open workbook, for
example, "[Book1]SHEET1!Sales". Name_text can also be a hidden name.
"""

Defining myRange on the worksheet and calling the following worksheet
function with "!myRange" returns the range in R1C1 notation (its actually
Z1S1 in a German Excel).

[WorksheetFunction(DeferRecalculation=true)]
public static XlOper GetName(String name)
{
return Excel.Call(Excel.Functions.xlfGetName, name);
}


Jens.


--
Jens Thiel * Willy-Brandt-Allee 10 * D-53113 Bonn * +49 228 5400124
http://jens-thiel.de/ http://ManagedXLL.net/ http://QuantLib.net/






  #6   Report Post  
Posted to microsoft.public.excel.sdk,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default xlfTextref

"Jerry W. Lewis" wrote in message
...
Thank you, that works; but is apparently yet another example where the C
API Excel4() function works differently than the corresponding Excel 4
macro function. Are these differences documented anywhere, or must they
be discovered by trial and error?


Welcome to the club. Microsoft documenation is just a rough guide, you need
to have a chat with your debugger to find out how things really work. Or if
you are feeling lazy, you can post your question to
microsoft.public.excel.sdk. :-)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"