ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get autoscroll in a multiline textbox? (https://www.excelbanter.com/excel-programming/420953-how-get-autoscroll-multiline-textbox.html)

Nicola M

How to get autoscroll in a multiline textbox?
 
Hi all.
I'd like add to my application a locked textbox where i show what the user
does (example: You have added x value, You have modified y parameter etc). My
text box has the multiline property set to true and the scrollbars set to
VerticalScrollBar.
Unfortunately the bar appears only if the textbox get the focus but in this
case also I don't get the automatic 1 row up scrolling. The effect I want is
what of end titles of a movie. Hoping my explanation be clear wait your
suggestions or advices.
Thank you in advance.

Nicola

RadarEye

How to get autoscroll in a multiline textbox?
 
Hi Nicola,

In XL2003 I have created this:

Option Explicit

Private Sub Worksheet_Change(ByVal target As Range)
txtLog.Text = txtLog.Text & vbNewLine & "Value of " & _
target.Address & " changed into " &
target.Value
GotoLastLine target
End Sub

Private Sub Worksheet_SelectionChange(ByVal target As Range)
txtLog.Text = txtLog.Text & vbNewLine & "Selection changed to " &
target.Address
GotoLastLine target
End Sub

Private Sub GotoLastLine(target As Range)
Application.EnableEvents = False
txtLog.Activate
txtLog.CurLine = (txtLog.LineCount - 1)
target.Select
Application.EnableEvents = True
End Sub

HTH,

Wouter


All times are GMT +1. The time now is 10:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com