benim anlayış doğru ise, kararın
için sorgulanan gereken bazı değişken Kodlama sabit alt/prosedür/etkinlik adının yalnızca önemsiz çözümü vardır Ben bu konuda SO içinde ince ve derin konuyu okumuş hatırlamak
için: ve sonunda çok karmaşık çözümlere içine kazma sonra, en basit bir sol ben
yukarıda yazmış ve daha az ayrıntılı bir sürede yapmak, Kamu değişkeni kullanmak neredeyse zorunlu neler oldu örnek:
Option Explicit
Public thingName As String
Sub main()
thingName = "Main" '"Mark" you're in 'Main' sub
'...
Call DoSomething 'call DoSomething() procedure
End Sub
Sub DoSomething()
thingName = "DoSomething" '"Mark" you're in 'DoSomething' sub
MsgBox ReturnSomething ' ReturnSomething() function
'...
End Sub
Function ReturnSomething()
thingName = "ReturnSomething" '"Mark" you're in 'ReturnSomething' Function
'...
ReturnSomething = "something"
End Function
elbette herhangi UserForm olay işleyicisi denizaltilarina genişletilmesi gerektiği de
daha kesin ve (umarım) ueseful ama uzun versiyonu:
Option Explicit
Public Type Thing
Name As String
Type As String
Job As String
End Type
Dim myThing As Thing
Sub main()
'"Mark" you're in 'Main' sub
With myThing
.Name = "Main"
.Type = "Sub"
.Job = "main procedure"
End With
'...
Call DoSomething 'call DoSomething() procedure
End Sub
Sub DoSomething()
'"Mark" you're in 'DoSomething' sub
With myThing
.Name = "DoSomething"
.Type = "Sub"
.Job = "procedure to do something"
End With
MsgBox ReturnSomething 'call ReturnSomething() function
'...
End Sub
Function ReturnSomething()
'"Mark" you're in 'ReturnSomething' Function
With myThing
.Name = "ReturnSomething"
.Type = "Function"
.Job = "procedure to return something"
End With
'...
ReturnSomething = "something"
End Function
Hayır, içinde bilmenin bir yolu yoktur prosedürü nasıl –
denir cevabım ile yanlış olabilir, ama cevabınızı doğru bir şekilde anlıyorsanız Application.caller kullanarak belirli şekillerde kullanmak istediğiniz bilgileri toplayabilirsiniz. – StormsEdge
@PaulOgilvie, o zaman işleri çok zorlaştırır. –