View Single Post
 
Old 08-01-2020, 07:21 AM
rekent rekent is offline Mac OS X Office for Mac 2011
Novice
 
Join Date: May 2014
Posts: 22
rekent is on a distinguished road
Default Get Sub Module Name using VBA and Truncate to Define Variable?

I have a UserForm with multiple buttons backed up by code for each individual button as follows:

Code:
Private Sub Name_Click()
  strName = "Name"
  Call ModuleName.SubName(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?
Reply With Quote