Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 19, 6:43*am, scattered wrote:
On Sep 18, 6:16*pm, Revolvr wrote: Thanks for the help so far, but something isn't right. When I use TextBox1.SelStart = Len(TextBox1.Text) I get a compile error "Invalid use of property" I cannot get the LineCount because it says control needs to have focus first, however, when I use TextBox1.SetFocus I get a run time error that says "Object doesn't support this property or method". If it helps, this is Excel 2003. Any ideas? The problem is that embedded text boxes work differently from those on forms. For the embedded ones, "Activate" evidently plays the role of SetFocus. In any event, as an experiment I used the control toolbox to create an embedded textbox and an embedded button which I renamed btnPress with the following click event: Private Sub btnPress_Click() * * Dim s As String * * s = InputBox("Enter message") * * If TextBox1.Text = "" Then * * * * TextBox1.Text = s * * Else * * * * TextBox1.Text = TextBox1.Text & vbCrLf & s * * End If * * TextBox1.Activate * * TextBox1.CurLine = TextBox1.LineCount - 1 * * TextBox1.SelStart = Len(TextBox1.Text) End Sub (This incorporates Rick's excellent suggestion which leaves the cursor at the end of the input - you can activate or select something else afterwards of course) This seems to work - just keep hitting button press and adding data. The bottom row is always visible hth -scattered That's it! Of course, Instead of using SetFocus to set focus, use Activate, if it's an embedded text box. I would not have guessed. That solved it. Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
scrolling textbox | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
Set Focus Problem for textbox control on multipage control | Excel Programming | |||
Scrolling TextBox...? | Excel Programming |