title: Having an MS Office UserForm detect which subroutine called it
body: <p>In a VBA project of mine I am/will be using a series of reasonably complex userforms, many of which are visually identical but have different subroutines attached to the buttons. As a result I'm not overly keen on the idea of duplicating them multiple times in order to get different functionality out of the same layout. Is it possible to have a userform detect which subroutine called it and use this in flow control? I would like to be able to do something like this:</p>
  
  <pre><code>Private Sub UserForm_Initialize()
      If [the sub that called the userform is called "foo"] then
          Call fooSub
      else
          Call barSub
      End If
  End Sub
  </code></pre>
  
  <p>My backup plan is to have the calling subroutine set a global variable flag and have the userform check that, but that seems like a rather crude and clumsy solution.</p>
  
  <p>Thanks everyone,<br>
  Louis</p>