Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lu Fischer   on Aug 17 In MS Office Category.

  
Question Answered By: Fuzairah Neeman    on Aug 17

Here are three methods.

1. This may not be feasible in your case, but you could combine the two forms
into one, as separate pages on a MultiPage control. Then you can refer directly
to the combobox from the other control, because they are members of the same
form.

2. The easiest other way is to use a global variable. In a VBA module in your
workbook, declare a global variable. For example:

Global SelText As String

In the code for the form  with the combobox, use the Change event to set the
value of SelText whenever a selection is made from the combobox. For example:

Private Sub ComboBox1_Change()
SelText$ = Me.ComboBox1.Value
End Sub

In the code for the other form, use the Activate event to update the control
on the form (for example, a textbox) with the current value of SelText. For
example:

Private Sub UserForm_Activate()
Me.TextBox1.Text = SelText$
End Sub

3. Instead of defining a global variable (some programmers object to them),
you could write the combobox value to a worksheet cell (perhaps on a hidden
sheet), then read the value in that cell from the second form.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on data transfer Or get search suggestion and latest updates.


Tagged: