Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-04-2009, 11:12 AM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
Force Display of Vertical Scroll Bars

Please Register to Remove these Ads

Hi,

I have created a form that has two textboxes on. It is used to edit existing data that is selected by a combobox on the same form.

Is there a way to force the textboxes to show scroll bars if the text exceeds the textbox height or just have them always shown?

It is difficult to distinguish on some of the data whether the data goes beyond what is visible. Without actually clicking into that textbox the scroll bars will not show.

Is this possible?

Thank you in advance

Last edited by jpruffle; 07-04-2009 at 12:55 PM.
Reply With Quote
  #2  
Old 07-04-2009, 11:21 AM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,220
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
re: Force Display of Vertical Scroll Bars

From a recent thread
http://www.excelforum.com/excel-prog...in-a-form.html

Code:
Private Sub UserForm_Initialize()

    With TextBox2
        .TabIndex = 0
        .ScrollBars = fmScrollBarsVertical
        .SelStart = 0
    End With
    
End Sub
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #3  
Old 07-04-2009, 11:40 AM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
re: Force Display of Vertical Scroll Bars

Thank you for the quick reply.

I did read that thread but wondered if it was possible for two textboxes to display the scrollbars at the same time? As you can only set the focus on one item I assume not?

Thank you in advance
Reply With Quote
  #4  
Old 07-04-2009, 11:48 AM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,220
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
re: Force Display of Vertical Scroll Bars

When the textboxes are preloaded with text the scrollbars get a bit fussy.

If you set the TabIndex to the second textbox and then in the activate event you set focus to the first textbox it appears to work.

Code:
Private Sub UserForm_Activate()
    TextBox1.SetFocus

End Sub

Private Sub UserForm_Initialize()

    With TextBox1
        .WordWrap = True
        .TabIndex = 0
        .ScrollBars = fmScrollBarsVertical
        .SelStart = 0
    End With
    
    With TextBox2
        .WordWrap = True
        .TabIndex = 0
        .ScrollBars = fmScrollBarsVertical
        .SelStart = 0
    End With
End Sub
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #5  
Old 07-04-2009, 11:57 AM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
re: Force Display of Vertical Scroll Bars

Again thank you for the quick reply.

I tried your method but unfortunately as the data gets changed and loaded after the form has initialised (i.e. to edit it) it doesn't seem to work.

As an alternative can any code be added so for example if the textbox exceeds 75 in height then show a label "Select for more Info". Or something like that?
Reply With Quote
  #6  
Old 07-04-2009, 12:00 PM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,220
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
re: Force Display of Vertical Scroll Bars

you need to post example as I can not guess the order of events occurring with code I can not see.
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #7  
Old 07-04-2009, 12:17 PM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
re: Force Display of Vertical Scroll Bars

The form is part of a very large spreadsheet so I have copied it over to a blank worksheet. However the functionality and data is not present.

On reflection I would almost prefer the ability to add text if the textbox exceeded a given height is that possible anyway?

I have attached my file.

Again thank you in advance.
Attached Files
File Type: xls showscrollbar.xls (69.5 KB, 6 views)
Reply With Quote
  #8  
Old 07-04-2009, 12:24 PM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,220
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
re: Force Display of Vertical Scroll Bars

Text boxes do not show the scrollbars until they contain text that required scrolling


I don't understand what you mean.
Quote:
I would almost prefer the ability to add text if the textbox exceeded a given height is that possible anyway?
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #9  
Old 07-04-2009, 12:35 PM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
re: Force Display of Vertical Scroll Bars

Apologies.

The form I attached can be used to add or edit existing data. It is more often used as a quick reference to look at an issue. So the user simply add an ID number and the relevant data is shown.

As the info and status textboxes do not show scroll bars at a quick glance the user is unable to determine whether there is more information further down without physically clicking into the textbox. I wanted to make that process quicker. I tried your example but I am unsure how when I retrieve the data how to show the scroll bars.

In relation to my second query in regarding textbox height. I was being stupid! I wondered if it might be possible for vba to know if the text inside the box is greater than say the text height. If so then show a label saying that it is, which again would quickly show the user that they need to click into the textbox.

Ultimately I'll tell the user to stop being lazy but thought it'd be worth a try.

Thank you in advance
Reply With Quote
  #10  
Old 07-04-2009, 12:46 PM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,220
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
re: Force Display of Vertical Scroll Bars

This code is the cut down to exclude all the assignments of data I don't have.
It fills the textboxes with rubbish. Reporting linecount in the labels.

Just click the combo box and enter "a"

Code:
Private Sub idlookup_Change()

    Me.taddinfo.Value = "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 17)" & vbLf & _
                        "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 17)" & vbLf & _
                        "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 17)"
    Me.taddresult.Value = "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 19)" & vbLf & _
                       "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 19)" & vbLf & _
                       "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 19)" & vbLf & _
                       "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 19)" & vbLf & _
                       "ws.Range(engageid).Cells(Me.idlookup.ListIndex + 1, 1).Offset(0, 19)"
    
    With Me.taddresult
        .SelStart = 0
        .SetFocus
        Label187.Caption = "Result/Update: [" & .LineCount & " lines]"
    End With
    With Me.taddinfo
        .SelStart = 0
        .SetFocus
        Label186.Caption = "Information: [" & .LineCount & " lines]"
    End With
    
End Sub
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #11  
Old 07-04-2009, 12:55 PM
jpruffle jpruffle is offline
Valued Forum Contributor
 
Join Date: 03 Jun 2008
Posts: 334
jpruffle is becoming part of the community
Re: Force Display of Vertical Scroll Bars

Thank you very much that will get me on the right track.

Thanks for your patience
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump