Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel4 Call to get Function String

"Matthew Wieder" wrote in message
...
How would I write the C++ XLL call that would take an XLOPER (of a
function) and get the string in that cell (i.e. the "=ThisFunc($A$3,
$F$7)") not the value that is returned by that function that is
displayed in the cell.


Hi Matthew,

I'm not sure I follow what you're asking for. Do you mean that if you
have the following function defined in your XLL:

EXPORT XLOPER MyFunc(XLOPER arg);

That you want a char* that looks something like "=MyFunc(A1)"?

That would seem to be self-evident. You know you have an equals sign
followed by the function name and a set of parenthesis containing a
comma-delimited list of the range addresses of the XLOPER arguments.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Excel4 Call to get Function String

That is what I need, but I need the actual string, not aa version I can
reconstruct. The difference is that I need to know whether a single
cell was entered as "$B$1" or as "B1:B1" which are equivalent once the
become passed in as XLOPERS so I need to get the actual string from the
cell.
thanks!

Rob Bovey wrote:

"Matthew Wieder" wrote in message
...

How would I write the C++ XLL call that would take an XLOPER (of a
function) and get the string in that cell (i.e. the "=ThisFunc($A$3,
$F$7)") not the value that is returned by that function that is
displayed in the cell.



Hi Matthew,

I'm not sure I follow what you're asking for. Do you mean that if you
have the following function defined in your XLL:

EXPORT XLOPER MyFunc(XLOPER arg);

That you want a char* that looks something like "=MyFunc(A1)"?

That would seem to be self-evident. You know you have an equals sign
followed by the function name and a set of parenthesis containing a
comma-delimited list of the range addresses of the XLOPER arguments.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel4 Call to get Function String

"Matthew Wieder" wrote in message
...
That is what I need, but I need the actual string, not aa version I can
reconstruct. The difference is that I need to know whether a single
cell was entered as "$B$1" or as "B1:B1" which are equivalent once the
become passed in as XLOPERS so I need to get the actual string from the
cell.


Hi Matthew,

I've never tried to do this, so I don't know for sure that there's a
solution. The following seems like it ought to work:

XLOPER xlRef, xlFormula;
Excel4(xlfCaller, &xlRef, 0);
Excel4(xlfGetFormula, &xlFormula, 1, &xlRef);

but in the quick tests I've done it doesn't. I'll play with it some more
when I get back home tonight. and post again if I can get it working.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Excel4 Call to get Function String

Yeah - I somehow combed ine net and discovered that same code segmant
which should do what I want, but the call to xlfGetFormula is failing
with a return code of 2 or "An invalid function number was supplied. If
you are using constants from XLCALL.H, this shouldn't happen." I checked
XLCall.h and xlfGetFormula is correctly defined as 106. I hope we can
solve this issue as it has become somewhat urgent for us.
thanks!

Rob Bovey wrote:

"Matthew Wieder" wrote in message
...

That is what I need, but I need the actual string, not aa version I can
reconstruct. The difference is that I need to know whether a single
cell was entered as "$B$1" or as "B1:B1" which are equivalent once the
become passed in as XLOPERS so I need to get the actual string from the
cell.



Hi Matthew,

I've never tried to do this, so I don't know for sure that there's a
solution. The following seems like it ought to work:

XLOPER xlRef, xlFormula;
Excel4(xlfCaller, &xlRef, 0);
Excel4(xlfGetFormula, &xlFormula, 1, &xlRef);

but in the quick tests I've done it doesn't. I'll play with it some more
when I get back home tonight. and post again if I can get it working.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Excel4 Call to get Function String

Hi Matthew,

e.g. You have a MyFunc in xll and at A1 you using the formula
"=MyFunc(parameters)"
Then you need to call the Excel4 after the MyFunc return.
Here is my code.
XLOPER xlRef, xlFormula;
xlRef.xltype=xltypeSRef;
xlRef.val.sref.count =1;
xlRef.val.sref.ref.rwFirst = 0;
xlRef.val.sref.ref.rwLast = 0;
xlRef.val.sref.ref.colFirst = 0;
xlRef.val.sref.ref.colLast = 0 ;
Excel(xlfGetFormula, &xlFormula, 1, &xlRef);
This will restrieve the "=MyFunc(parameters)" in the xlFormula.val.str

You may have a try and let me know if this does the job for you.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
Date: Mon, 22 Sep 2003 14:09:09 -0400
From: Matthew Wieder
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)

Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en, he
MIME-Version: 1.0
Subject: Excel4 Call to get Function String
References:




In-Reply-To:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID:
Newsgroups: microsoft.public.excel.programming
NNTP-Posting-Host: 207.106.112.178
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.excel.programming:418054
X-Tomcat-NG: microsoft.public.excel.programming

Yeah - I somehow combed ine net and discovered that same code segmant
which should do what I want, but the call to xlfGetFormula is failing
with a return code of 2 or "An invalid function number was supplied. If
you are using constants from XLCALL.H, this shouldn't happen." I checked
XLCall.h and xlfGetFormula is correctly defined as 106. I hope we can
solve this issue as it has become somewhat urgent for us.
thanks!

Rob Bovey wrote:

"Matthew Wieder" wrote in message
...

That is what I need, but I need the actual string, not aa version I can
reconstruct. The difference is that I need to know whether a single
cell was entered as "$B$1" or as "B1:B1" which are equivalent once the
become passed in as XLOPERS so I need to get the actual string from the
cell.



Hi Matthew,

I've never tried to do this, so I don't know for sure that there's a
solution. The following seems like it ought to work:

XLOPER xlRef, xlFormula;
Excel4(xlfCaller, &xlRef, 0);
Excel4(xlfGetFormula, &xlFormula, 1, &xlRef);

but in the quick tests I've done it doesn't. I'll play with it some more
when I get back home tonight. and post again if I can get it working.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel4 Call to get Function String

Hi Peter,

The problem is that Matthew is trying to get the function string from
within the function itself. As far as I can tell, xlfGetFormula does not
work when called from within a function and passed the address of the cell
(as returned by xlfCaller) from which that function was called.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Peter Huang [MSFT]" wrote in message
...
Hi Matthew,

e.g. You have a MyFunc in xll and at A1 you using the formula
"=MyFunc(parameters)"
Then you need to call the Excel4 after the MyFunc return.
Here is my code.
XLOPER xlRef, xlFormula;
xlRef.xltype=xltypeSRef;
xlRef.val.sref.count =1;
xlRef.val.sref.ref.rwFirst = 0;
xlRef.val.sref.ref.rwLast = 0;
xlRef.val.sref.ref.colFirst = 0;
xlRef.val.sref.ref.colLast = 0 ;
Excel(xlfGetFormula, &xlFormula, 1, &xlRef);
This will restrieve the "=MyFunc(parameters)" in the xlFormula.val.str

You may have a try and let me know if this does the job for you.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
Date: Mon, 22 Sep 2003 14:09:09 -0400
From: Matthew Wieder
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)

Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en, he
MIME-Version: 1.0
Subject: Excel4 Call to get Function String
References:




In-Reply-To:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID:
Newsgroups: microsoft.public.excel.programming
NNTP-Posting-Host: 207.106.112.178
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.excel.programming:418054
X-Tomcat-NG: microsoft.public.excel.programming

Yeah - I somehow combed ine net and discovered that same code segmant
which should do what I want, but the call to xlfGetFormula is failing
with a return code of 2 or "An invalid function number was supplied. If
you are using constants from XLCALL.H, this shouldn't happen." I checked
XLCall.h and xlfGetFormula is correctly defined as 106. I hope we can
solve this issue as it has become somewhat urgent for us.
thanks!

Rob Bovey wrote:

"Matthew Wieder" wrote in message
...

That is what I need, but I need the actual string, not aa version I can
reconstruct. The difference is that I need to know whether a single
cell was entered as "$B$1" or as "B1:B1" which are equivalent once the
become passed in as XLOPERS so I need to get the actual string from the
cell.


Hi Matthew,

I've never tried to do this, so I don't know for sure that there's

a
solution. The following seems like it ought to work:

XLOPER xlRef, xlFormula;
Excel4(xlfCaller, &xlRef, 0);
Excel4(xlfGetFormula, &xlFormula, 1, &xlRef);

but in the quick tests I've done it doesn't. I'll play with it some

more
when I get back home tonight. and post again if I can get it working.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Excel4 Call to get Function String

After doing as much research as I could (very limited with the weak web
resources on this topic) it seems that xlfCaller is a Level 2 Macro call
and can only be called from a Function registered with a # at the end of
the type_text. Pulling someone else's code, I created a small function
that gets the cell formula and passes it back in an XLOPER. I
registered that function with the # and then I use xlUDF to call it and
get the XLOPER it returns in my main code. For the time being,
everything seems to be working OK.
Thanks for your efforts.

Rob Bovey wrote:
Hi Peter,

The problem is that Matthew is trying to get the function string from
within the function itself. As far as I can tell, xlfGetFormula does not
work when called from within a function and passed the address of the cell
(as returned by xlfCaller) from which that function was called.


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a do not call function? pokdbz Excel Discussion (Misc queries) 2 December 27th 07 04:00 PM
Excel: Use pic location string to call up picuture in cell? vloh28 Excel Discussion (Misc queries) 1 October 30th 07 12:42 AM
Custom Function Call Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 5 September 6th 05 06:14 PM
how i can call the function reneabesmer Excel Worksheet Functions 2 May 2nd 05 12:13 PM
call function sirron Excel Programming 1 August 26th 03 03:39 PM


All times are GMT +1. The time now is 12:05 PM.

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"