title: Global Variable in Userform
body: <p>I search about this in the forum and found some answers but did not work for me.</p>
  
  <p>I have two UserForms.</p>
  
  <p>In the first one, I give a value to a variable called Word.</p>
  
  <p>In the second one, I have a Label that I need the caption to become the variable Word.</p>
  
  <p>Example:</p>
  
  <pre><code>Public Word as String
  
  Private Sub Userform1_Activate
     Word = "Today Is Saturday"
  End Sub
  
  Private Sub Userform2_Activate
     Label1.Caption = Word
  End Sub
  </code></pre>
  
  <p>But this does not work. The Label caption gets Zero for value. 
  Could anybody help me on this?</p>
  
  <p>Thanks.</p>
  
  <pre><code>First Form
  
  Private Sub CommandButton5_Click()
  
  Db = "C:\Users\Desktop\db.txt"
  
  Set File1 = CreateObject("Scripting.FileSystemObject")
  Set File2 = File1.OpenTextFile(Db, 1)
  
  Do Until File2.AtEndOfStream
  
  If (File2.Readline = TextBox1) Then Exit Do
  If File2.AtEndOfStream Then WordNotFound.Show
  If File2.AtEndOfStream Then TextBox1.Value = ""
  If File2.AtEndOfStream Then Exit Sub
  
  Loop
  
  Word = File2.Readline
  
  MsgBox Word
  
  TextBox1.Value = ""
  
  End Sub
  </code></pre>
  
  <p>Second Form</p>
  
  <pre><code>Private Sub UserForm_Click()
  
  Label1.Caption = Word
  
  End Sub
  </code></pre>