Consulting

Results 1 to 5 of 5

Thread: Solved: Show text from textbox on worksheet in textbox on userform

  1. #1
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    3
    Location

    Solved: Show text from textbox on worksheet in textbox on userform

    In Excel, there are:

    1) A text-containing Autoshape Text Box ("tbWorksheet") residing in a Worksheet .
    2) A vba object textbox ("tbUserForm") residing in an attached UserForm.

    I wish to link tbWorksheet and tbUserForm such that text in tbWorksheet appears in tbUserForm.

    I have tried various linkages utilizing control source property, tb__.Text, tb__.Value, etc but can't make it work. Tr?s frustrant.
    Any assistance is greatly appreciated. Thanks in abundance.
    Last edited by ceeejayy; 04-25-2007 at 09:39 AM.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    is the textbox on the sheet from the forms toolbar or the vb control toolbox?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    3
    Location
    The worksheet textbox originates from the Drawing toolbar, not the Control nor the Forms nor the Visual Basic toolbars. Excel seems to regard the textbox as a Shape.
    Last edited by ceeejayy; 04-25-2007 at 09:42 AM.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    this seems to work for me:
    [VBA]
    Private Sub UserForm_Initialize()
    TextBox1.Text = Worksheets(1).Shapes("Text Box 1").TextFrame.Characters.Text
    End Sub
    [/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    3
    Location

    Thumbs up

    Quote Originally Posted by lucas
    this seems to work for me:
    [vba]
    Private Sub UserForm_Initialize()
    TextBox1.Text = Worksheets(1).Shapes("Text Box 1").TextFrame.Characters.Text
    End Sub
    [/vba]
    Dear Lucas,

    Mirabile dictu, your code is perfect. Thanks for solving my simple but thorny problem.

Posting Permissions

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