LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default autscrolling textbox on modeless userform

I am using a modeless form with a text box to display
some debugging information while some routines are running.
it works like this:

Sub PrintDebug(Msg As String)
ErrorForm.ErrorTextBox = ErrorForm.ErrorTextBox & _
"Debugging: " & Msg & vbLf
End Sub

I would like the text box to scroll down when it has more text than can
be displayed at once.
With the code above, always the text from the start is displayed.
What do I need to do to make the displayed text
scroll automatically without giving the textbox (or the userform)
focus?


I found some VB code which is supposed to d this in VB, not in VBA.
But I have no idea who I can get the handle of a Textbox
(or of any forms element) in VBA.

Option Explicit

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long
Private Const EM_LINESCROLL = &HB6


Private Sub Command1_Click()

Text1.Text = Text1 & "test" & vbCrLf
PostMessage Text1.hwnd, EM_LINESCROLL, 0&, 2& 'scrolls down 2 lines, or
to bottom.
End Sub
</PRE</CODE

 
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
Modeless userform hngo New Users to Excel 2 July 13th 05 09:23 AM
Modeless Userform problem Harald Staff Excel Programming 1 September 3rd 04 06:28 PM
Modeless Userform problem Robin Hammond[_2_] Excel Programming 0 September 2nd 04 02:29 PM
modeless userform jacob Excel Programming 1 May 4th 04 02:53 PM
Modeless userform jacob[_3_] Excel Programming 2 September 29th 03 08:02 PM


All times are GMT +1. The time now is 05:09 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"