Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi to all,
I would like to know if it is possible to know who has called a certain function. For example, I have three functions "printPage", "printPage1", "printPage2" which can called another function "PrintToPdf". I'm am in the "PrintToPdf" function. Is it possible to know which function has called me ? Thks for your answer Best regards |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Isabelle,
There is no way to programmatically determine what procedure called another procedure. In debug mode, you can view the call stack (View menu, Call Stack), but this is not available programmatically. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Isabelle Robin" wrote in message ... Hi to all, I would like to know if it is possible to know who has called a certain function. For example, I have three functions "printPage", "printPage1", "printPage2" which can called another function "PrintToPdf". I'm am in the "PrintToPdf" function. Is it possible to know which function has called me ? Thks for your answer Best regards |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chip's right, but if you wanted to edit your code you could always pass the
routine a parameter. Sub MySub(strCaller as string) debug.print strCaller 'do stuff End Sub Calling routines like this Sub1 MySub "1" End Sub Sub 2 MySub "2" End Sub Robin Hammond www.enhanceddatasystems.com "Chip Pearson" wrote in message ... Isabelle, There is no way to programmatically determine what procedure called another procedure. In debug mode, you can view the call stack (View menu, Call Stack), but this is not available programmatically. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Isabelle Robin" wrote in message ... Hi to all, I would like to know if it is possible to know who has called a certain function. For example, I have three functions "printPage", "printPage1", "printPage2" which can called another function "PrintToPdf". I'm am in the "PrintToPdf" function. Is it possible to know which function has called me ? Thks for your answer Best regards |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Isabelle,
You can use a different argument in each calling function, then identify the argument in the called function, something like... '----------------------- Function PrintPage() PrintToPdf (0) End Function Function PrintPage1() PrintToPdf (1) End Function Function PrintPage2() PrintToPdf (2) End Function Function PrintToPdf(ByRef F As Long) Select Case F Case 0 'Do some code MsgBox F Case 1 'Do different code MsgBox F Case 2 'Do really different code MsgBox F End Select End Function '-------------------------- Regards, Jim Cone San Francisco, CA "Isabelle Robin" wrote in message ... Hi to all, I would like to know if it is possible to know who has called a certain function. For example, I have three functions "printPage", "printPage1", "printPage2" which can call another function "PrintToPdf". I'm am in the "PrintToPdf" function. Is it possible to know which function has called me ? Thks for your answer Best regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I know which cell a function is called from? | Excel Worksheet Functions | |||
What is this function called?? | Excel Discussion (Misc queries) | |||
Function, dont know what its called | Excel Worksheet Functions | |||
mystery function called 'TABLE' | Excel Worksheet Functions | |||
Determining whether function called by Excel or VBA | Excel Programming |