title: Passing variable from Form to Module in VBA
body: <p>I have the following button on a Form:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
   Dim pass As String
   pass = UserForm1.TextBox1
   Unload UserForm1
  End Sub
  </code></pre>
  
  <p>I then have a Module called Module1:</p>
  
  <pre><code> Public Sub Login()
  
   ...
  
   UserForm1.Show
   driver.findElementByName("PASSWORD").SendKeys pass
  
   ...
  
  End Sub
  </code></pre>
  
  <p>The idea is whatever password the users enters into the input box will be assigned to the variable <code>pass</code>. What I'm having trouble doing however is passing <code>pass</code> from UserForm1 into Module1's Login sub.</p>
  
  <p>I would of thought adding something like <code>Module1.Login (pass)</code> to my form before I unload it would work, however that doesn't seem to pass anything. Any help would be much appreciated. Thanks.</p>