Results 1 to 3 of 3

Thread: Active X Textbox Content to Userform Textbox

  1. #1

    Active X Textbox Content to Userform Textbox

    I have a workbook with multiple active x textboxes. I want to have expanded view for each textbox and would prefer a userform textbox. Each time the user double clicks on the active x textbox, the userform is displayed filled with the contents of the active x textbox. In the userform, the user can edit the content and save the content back to the active textbox as well. I don't want to create multiple userforms for each active textbox and would prefer only one. My problem is how to code macro telling which active textbox to import. I have attached a sample workbook to illustrate this problem.
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Guru
    Apr 2012
    Although I don't see any benefit in this approach:

    Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        UserForm1.Tag = 1
    End Sub
    Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        UserForm1.Tag = 2
    End Sub
    Private Sub UserForm_Activate()
        TextBox1 = Sheet1.OLEObjects("TextBox" & Tag).Object.Text
    End Sub
    Private Sub CommandButton2_Click()
        Sheet1.OLEObjects("TextBox" & Tag).Object.Text = TextBox1
    End Sub
    Private Sub CommandButton1_Click()
    End Sub

  3. #3
    you again saved the day snb. thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts