title: Assigning a variable directly from a userform
body: <p>I am trying to add some code to have a userform pop up which allows the end user to input their login/password for s specific website. This code <a href="https://stackoverflow.com/questions/20214072/passing-variable-from-form-to-module-in-vba">Passing variable from Form to Module in VBA</a> got me closer to my goal but I am not sure how to make it work the way I need to. Here is the code for my userform. </p>
  
  <pre><code>Private Sub CommandButton1_Click()
  UPass = UserForm1.UserID
  Unload UserForm1
  End Sub
  
  Private Sub CommandButton1_Click()
  UID = UserForm1.WavePassword
  Unload UserForm1
  End Sub
  </code></pre>
  
  <p>And I am using the below in the code to log into the website.</p>
  
  <pre><code>    Public Sub Connect_To_Wave()
      Dim Dasboard As Worksheet
          Set Dashboard = ActiveWorkbook.Worksheets("Dashboard")
      Dim UID As String
          UID = driver.findElementByName("PASSWORD").SendKeys UID
      Dim UPass As String
          UPass = driver.findElementByName("PASSWORD").SendKeys Upass
  
  
  
  
  Set ie = CreateObject("InternetExplorer.Application")
  my_url = "url of website - not a variable"
  
  With ie
      .Visible = True
      .Navigate my_url
      .Top = 100
      .Left = 530
      .Height = 700
      .Width = 400
  
  Do Until Not ie.Busy And ie.readyState = 4
      DoEvents
  Loop
  
  End With
  
  ie.Document.getElementById("txtLoginUsername").Value = ""
  ie.Document.getElementById("txtLoginPassword").Value = ""
  ie.Document.getElementById("txtLoginUsername").Value = UID
  ie.Document.getElementById("txtLoginPassword").Value = UPass
  ie.Document.getElementById("btnLogin").Click
  
  Do Until Not ie.Busy And ie.readyState = 4
      DoEvents
  Loop
  End Sub
  </code></pre>
  
  <p>The issue I am running into is that I get an error of "expected end of statement" on the uid/upass variables. How do I correctly get the userform to pass the input directly into the variable so the variable can be used to log into the website? I am completely open to change the method if there is a better way as well.</p>