Return a string based on which Textbox is clicked
Hi Andy,
I dit not compleetly build your situation.
I created 1 module with:
Public clickedBox As Control
I created 2 forms
On form 1 two textboxes.
For the textboxes I filled the Tag property with something.
And with the code:
Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Set clickedBox = Me.TextBox1
UserForm2.Show
End Sub
Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Set clickedBox = Me.TextBox2
UserForm2.Show
End Sub
On Form2 1 Label, 1 Textbox and 2 buttions ( OK and cancel)
And with the code:
Private Sub Cancel_Click()
Me.Hide
End Sub
Private Sub cmdOK_Click()
clickedBox.Text = Me.TextBox1.Text
Me.Hide
End Sub
Private Sub UserForm_Activate()
Me.Label1.Caption = clickedBox.Tag
Me.TextBox1.Text = clickedBox.Text
End Sub
HTH,
Wouter
|