Question on Userform.Textbox Scrollbars

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
204
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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
204
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
 
Solution

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
51,831
Office Version
  1. 365
Platform
  1. Windows
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
 

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
204
BTW, if you want to bold (or other format) vba code yourself, use the 'RICH' code tags instead of the VBA tags.
e.g.

Yes Sir Will take care and use RICH Code Tags

SamD
183
 

Forum statistics

Threads
1,148,156
Messages
5,745,100
Members
423,923
Latest member
yuvaraj859

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
Top