Question on Userform.Textbox Scrollbars

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
205
Hello

I've a query on scrollbar for Textbox
Managed to start from Top of Textbox with Scrollbars.

BUT
1. when you Initialize the Userform both the scrollbars are not seen although Textbox1.ScrollBars = fmScrollBarsBoth

VBA Code:
With UserForm1.Textbox1
  .height = 337.5  'The same is mentioned in property of textbox1
  .width = 882      'The same is mentioned in property of textbox1
  .Multiline = True [B]'The same is mentioned in property of textbox1
  .Font.Name = "Courier New"
  .Font.Size = 8
  .SelStart = 0
  .SelLength = 0
  .ScrollBars = fmScrollBarsBoth
End With
Also Why Scrollbars are not visible until you scroll down the Last line which is displayed in Textbox ?
when crossed down the Last line of Textbox vertical scrollbar is displayed immediately and not the Horizontal scrollbar

My textbox data is more than 250 lines.
So what happens if i cross the 29th line from Top the vertical scrollbar appears but does not display the horizontal bar

Any ways to fix the above ie both the scrollbars are visible. The text starts from 1st line

2. Again in Textbox if the length of Line is > than width of the textbox1 then data at the end of the 1st line goes to next line.
How to fix this also so that first line is extended

SamD
180
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Guys Resolved
OMG After much expolaration :LOL::LOL:
Textbox1.WordWrap = True 'This was only required
VBA Code:
With UserForm1.Textbox1
  .height = 337.5  'The same is mentioned in property of textbox1
  .width = 882      'The same is mentioned in property of textbox1
  .Multiline = True [B]'The same is mentioned in property of textbox1
  [B].WordWrap = True [/B]
  .Font.Name = "Courier New"
  .Font.Size = 8
  .SelStart = 0
  .SelLength = 0
  .ScrollBars = fmScrollBarsBoth
End With
SamD181
 
Upvote 0
Solution
Glad you got it sorted & thanks for posting the result. (y)

BTW, if you want to bold (or other format) vba code yourself, use the 'RICH' code tags instead of the VBA tags.
e.g.
Rich (BB code):
With UserForm1.Textbox1
  .Height = 337.5  'The same is mentioned in property of textbox1
  .Width = 882      'The same is mentioned in property of textbox1
  .MultiLine = True 'The same is mentioned in property of textbox1
  .WordWrap = True
  .Font.Name = "Courier New"
  .Font.Size = 8
  .SelStart = 0
  .SelLength = 0
  .ScrollBars = fmScrollBarsBoth
End With
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top