Corticus
Well-known Member
- Joined
- Apr 30, 2002
- Messages
- 1,579
Hi all,
I'm messing around with self-referencing in procedures, I wondered,
How do I retrieve the name of the module from which a procedure is running?
I'm playing with this code:
I would like to figure out what strModName is some other way besides looping through all the modules. Something like me.module.name, but that obviously doesn't work.
In the same way you retreive a forms name like Me.Name, I would like to do the same from a procedure.
Thanks,
I'm messing around with self-referencing in procedures, I wondered,
How do I retrieve the name of the module from which a procedure is running?
I'm playing with this code:
Code:
Sub quine()
For I = 0 To Application.Modules.Count - 1
If Modules(I).Lines(1, 1) = "Sub quine()" Then
strModName = Modules(I).Name
End If
Next I
DoCmd.OpenModule strModName
ct = Modules(strModName).CountOfLines
For I = 1 To ct
strMod = strMod & Chr(10) & Modules(strModName).Lines(I, 1)
Next I
Modules(strModName).InsertLines ct, "'I'm learning"
MsgBox (strMod)
End Sub
I would like to figure out what strModName is some other way besides looping through all the modules. Something like me.module.name, but that obviously doesn't work.
In the same way you retreive a forms name like Me.Name, I would like to do the same from a procedure.
Thanks,