You can use Application.Caller
to glean information about where your procedure is being called from.
I've used Application.Caller.Column
to find what location my data was coming from in order to satisfy conditionals.
Example of how I've used the method:
If Application.Caller.Column = 20 Then Call ChangeDirectionForSellSide(firstLegBuySell, secondLegBuySell, futureLegBuySell)
'First option leg built
chatConfirmString = "You " & firstLegBuySell & " " & Format(firstLegQuantity, "#,##0") & DetermineProductMeasurementType(productType, tradeDataRange.Item(2).Value, contractMonth) & " " & productType & " " & tradeDataRange.Item(2).Value & " " & contractMonth & " " & Format(tradeDataRange.Item(6).Value, "#,###.00##") & " " & tradeDataRange.Item(7).Value & " @ "
'Formats the price type
If productType = "WTI" Or productType = "BRT ICE" Or productType = "FO 3.5%" Or productType = "GO" Then
chatConfirmString = chatConfirmString & Format(tradeDataRange.Item(8).Value, "#,###.00")
Else
chatConfirmString = chatConfirmString & Format(tradeDataRange.Item(8).Value, "#,###.0000")
End If
There are a few issues with the code you posted above.
You're utilizing the Application syntax wrong (from misunderstanding). You would have to refer to it as Application.Caller.
"what ever object" you're trying to reference. Procedures are not objects (at least to my knowledge they're not), but what are the possible circumstances that could be presented in your code? Is this for a UDF and therefore could return a range? Could it return a sheet? Where is the procedure? These are questions that we would need to answer in order to accurately create a conditional that would evaluate a boolean value to true or false.