ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining whether function called by Excel or VBA (https://www.excelbanter.com/excel-programming/271859-determining-whether-function-called-excel-vba.html)

Ryan Poth[_2_]

Determining whether function called by Excel or VBA
 
Another one I cannot seem to figure out..

I'm trying to determine within a function whether it has
been called directly from Excel or from another VBA
sub/function. I've tried looking for ways to access the
call stack, but have had no luck.

Does anybody have any clues on this one?

Thanks in advance,
Ryan

Ryan Poth[_2_]

Determining whether function called by Excel or VBA
 
Tried that one too. Unfortunately, it returns information
about where VBA was ultimately called from and, since all
my functions are ultimately called from Excel, that
doesn't work. That is, unless there's more to the Caller
property than I'm seeing.

Any other ideas?

-----Original Message-----
Checkout the Caller property.

Alan Beban

Ryan Poth wrote:
Another one I cannot seem to figure out..

I'm trying to determine within a function whether it

has
been called directly from Excel or from another VBA
sub/function. I've tried looking for ways to access the
call stack, but have had no luck.

Does anybody have any clues on this one?

Thanks in advance,
Ryan


.


Alan Beban[_3_]

Determining whether function called by Excel or VBA
 
I guess I don't know what you mean by "called directly from Excel or
from another VBA sub/function." Perhaps you could provide a brief
illustration of each, and what you are trying to learn.

Alan Beban

Ryan Poth wrote:
Tried that one too. Unfortunately, it returns information
about where VBA was ultimately called from and, since all
my functions are ultimately called from Excel, that
doesn't work. That is, unless there's more to the Caller
property than I'm seeing.

Any other ideas?


-----Original Message-----
Checkout the Caller property.

Alan Beban

Ryan Poth wrote:

Another one I cannot seem to figure out..

I'm trying to determine within a function whether it


has

been called directly from Excel or from another VBA
sub/function. I've tried looking for ways to access the
call stack, but have had no luck.

Does anybody have any clues on this one?

Thanks in advance,
Ryan


.




Dave Peterson[_3_]

Determining whether function called by Excel or VBA
 
Called from a cell (worksheet function)??

If TypeOf Application.Caller Is Range Then
'it's from a UDF in a cell
Else
'it's not from a UDF in a cell
End If

Ryan Poth wrote:

Tried that one too. Unfortunately, it returns information
about where VBA was ultimately called from and, since all
my functions are ultimately called from Excel, that
doesn't work. That is, unless there's more to the Caller
property than I'm seeing.

Any other ideas?

-----Original Message-----
Checkout the Caller property.

Alan Beban

Ryan Poth wrote:
Another one I cannot seem to figure out..

I'm trying to determine within a function whether it

has
been called directly from Excel or from another VBA
sub/function. I've tried looking for ways to access the
call stack, but have had no luck.

Does anybody have any clues on this one?

Thanks in advance,
Ryan


.


--

Dave Peterson



All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com