LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Tell whether or not Sub B was called by Sub A?

For example, if I have two Subs in my project, say A and B, and B may
sometimes be called from within A and at other times it may be run
independently of A, other than setting a global Boolean as illustrated
below, is there a slick way of telling?

Dim SubBCalledFromSubA as Boolean

Sub A()
'first reset Boolean, just in case
SubBCalledFromSubA = FALSE

.....

SubBCalledFromSubA = TRUE
Call B
....

'reset Boolean
SubBCalledFromSubA = FALSE
End Sub

Sub B()
If SubBCalledFromSubA = TRUE Then
'code here
End If

If SubBCalledFromSubA = FALSE Then
'some other code here
End If
End Sub

I thought that Application.Caller (or something similar) might be relevant
here, but it doesn't appear to be, judging by the help file.

Thanks

Ian

 
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
called macro Rick Excel Programming 4 December 19th 07 11:31 PM
what is this called? : < Jake Excel Worksheet Functions 1 November 28th 06 11:01 AM
What is this called in Excel? Mike Excel Programming 2 August 10th 06 02:46 PM
XLA function called twice Nigel[_9_] Excel Programming 0 November 16th 04 10:46 AM
Run Workbook_Open only if called Jarek[_14_] Excel Programming 0 September 18th 04 10:05 AM


All times are GMT +1. The time now is 03: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"