Pass string value to another form

  • Thread starter Thread starter yangyh
  • Start date Start date
Y

yangyh

dear all,

I want to pass the string value (defined in Form1) to another For
(Form2). Can I use the following codes in Form1

Private Sub NextBotton_Click()
....
With UserForm2
...
String2 = String1
End With
End Sub

String2 is defined in Form2. Unfortunetly, String2 did not get th
value as expected. How can I pass the string values between tow forms
Thanks.

Davi
 
Hi David,

Declare sStr1 as global variable at the top of a standard module:

Option Explicit
Public sStr1 As String

The sStr1 variable's value can then be assigned in a UserForm1 routine and
this value will be available to Userform2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top