Scrolling TextBox...?

R

Robert Stober

Hi,

Does Excel offer any type of scrolling text box?

Thank you,

Robert Stober
 
H

Harald Staff

Hi Robert

The controls toolbox has a textbox for use in spreadsheets and userforms.
Set its Multiline to true, Wordwrap to true and Scrollbars to whichever
desired.
 
P

pfsardella

Watch for linewrap. Adds a TextBox with scrolling capability.

Sub FileIntoTextBox()
'' Adds a text box which has a scroll bar.

Dim txtBox As MSForms.TextBox
Dim oleTB As OLEObject
Dim wSht As Worksheet
Dim wBk As Workbook

Application.ScreenUpdating = False

[a1].Select

Set wBk = ActiveWorkbook
Set wSht = wBk.ActiveSheet

Set oleTB = wSht.OLEObjects.Add(ClassType:="Forms.TextBox.1",
link:=False, _
DisplayAsIcon:=False, Left:=1, Top:=1, Width:=600,
Height:=150)
With oleTB
.Visible = True
.Name = "MyTextBox"
End With
Set txtBox = oleTB.Object

With txtBox
.Top = ActiveWindow.VisibleRange.Top + 100
.Left = ActiveWindow.VisibleRange.Left + 100
.MultiLine = True
.ScrollBars = 2
.EnterKeyBehavior = True
.Font.Name = "Courier New"
.Font.Size = 8
.SelStart = 1
End With

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top