LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Control scrolling in a TextBox

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
scrolling textbox Shawn G. Excel Programming 1 September 12th 06 07:01 PM
How to move cursor from one textbox control to another textbox con Tom Ogilvy Excel Programming 1 September 16th 04 03:42 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Scrolling TextBox...? Robert Stober Excel Programming 2 October 14th 03 09:24 AM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"