PDA

View Full Version : set a variable equal to the sub name



Djblois
05-21-2007, 06:28 AM
Is it possible to set a variable to the name of the sub without doing it manually? I use this code in every sub:

SaveSetting "Business Reporting Today", "Debug", "End", "comBandRows"

'"comBandRows" is the name of the sub, I find it very tedious to have to change the name to the sub after I copy over the line, so I want to know if I can replace "comBandRows" with a variable or replace it with a code that will name it after the sub?

Charlize
05-21-2007, 07:11 AM
Something like this ?Sub main()
sub_main ("comBandRows")
End Sub
Function sub_main(v_module As String)
SaveSetting "Business Reporting Today", "Debug", "End", v_module
End Function

Djblois
05-21-2007, 07:22 AM
Thank you Charlize but that is the same thing I am doing no I would still have to copy over the name into the spot for the

sub_main ("comBandRows")

I guess this is probably not possible then.

Bob Phillips
05-21-2007, 07:32 AM
If you mean can you get the name of the procedure automatically, no you can't.