PDA

View Full Version : Get VBA Module Name via VBA and Truncate



rekent
08-01-2020, 01:24 AM
I have a UserForm with multiple buttons backed up by code for each individual button as follows:


Private Sub Name_Click()
strName = "Name"
Call Module.Sub(strName)
Unload Me
End Sub

where Name changes for each button. Rather than hardcoding strName = "Name" I would like to reference the name of the module and truncate the _Click() portion of the module name to then get the function for my strName definition. Is this something that is possible within VBA?