Hello all
I have inserted a scroll box into a user form and it is working however, when I open the form it will not allow me to insert anything into the scroll box. Why is this and how do I fix it?
Thank-you Cheeco
Hello all
I have inserted a scroll box into a user form and it is working however, when I open the form it will not allow me to insert anything into the scroll box. Why is this and how do I fix it?
Thank-you Cheeco
Is a scroll box a non-standard form?
A List Box has to have its entries entered via VBA and inserting something into a Scroll Bar doesn't make sense to me.
Could you attach a workbook with your form?
BTW, this is a cross post.
http://www.ozgrid.com/forum/showthread.php?t=198646
http://www.vbaexpress.com/forum/show...-INSIDE-A-FORM
Please read the link in my sig about cross posting politely.
Last edited by mikerickson; 02-13-2016 at 09:37 PM.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
I have attached a copy. The add, reset and close buttons I have not been able to get to work iether
What you are calling a scroll box is a Frame control.
Frames do not contain values, they are a holder for other user form controls.
The scroll bar on a frame is for the situation where the controls in that frame are spread out over an "area" larger than the size of the frame. The scroll bars on the side of the frame allow the user to scroll to those controls that are outside the size of the frame.
But you haven't put any controls into Frame 2, so there is no need for the scroll bars to be present. (You'd also have to set the .ScrollHeight property to make the scroll bars useful.)
If you want to put values in that area, you have to (optimally at design time) put controls (like a TextBox or a ComboBox) into the Frame so the user can click on those controls and enter the values.
Sorry Mikerickson. I for got about posting this Also posted at. It wont let me post the URL. It says something to do with forbidden words. I apologize that I broke the rules. Please tell me how I am suppose to add the other post URL.
Hoe come when I go to put in a web address it will not allow me to? Then I brake the rules by cross posting.
Thank-you Mikerickson. I will give that a try. It is a learning experience for me.
I will give it a try and let you know how it works out.
Thank-you Cheeco
The below is what I am working off of. After your info I don't think it is my best bet.
VBA - Working with Scroll Bars - The most simplest way
It cannot get more simpler than this
This piece of code is applicable for forms and controls like Frame
1) Forms
Insert a new form and change it's height to say 420 (see pic1)
Place a few controls on the form.
Once you are done, change the height to say 255 (See pic2)
Now you don't need to add a scroll bar. Simply paste this code in the UserForm Activate event as shown below and your userform with scrollbars is ready. (see pic3)
Code:
Private Sub UserForm_Activate()
With Me
'This will create a vertical scrollbar
.ScrollBars = fmScrollBarsVertical
'Change the values of 2 as Per your requirements
.ScrollHeight = .InsideHeight * 2
.ScrollWidth = .InsideWidth * 9
End With
End Sub
and run the form. you will get the desired result.
2) Frames
Add a frame to the userform and name it say Frame1 (See pic4). In the userform activate event simply paste this code and your frame with a scroll bar is ready (See pic5). Again you don't need to add scrollbars control to the frame.
Code:
Private Sub UserForm_Activate()
'Name of the frame
With Me.Frame1
'This will create a vertical scrollbar
.ScrollBars = fmScrollBarsVertical
'Change the values of 2 as Per your requirements
.ScrollHeight = .InsideHeight * 2
.ScrollWidth = .InsideWidth * 9
End With
End Sub
Last edited by Cheecochongo; 02-13-2016 at 10:07 PM.
I'm not sure what you are after and why you want a frame.
If you want a single text box to enter long pieces of text (paragraphs), you don't need a frame. You'd use a text box.
If you have lots of controls but little space, you'd use a Frame.
See the two pages of the Multipage in the attached to see the difference.
Thank-you Mikerickson. That is very helpful. I can use as a example. I will save this file for future reference.
Last edited by Cheecochongo; 02-14-2016 at 09:14 AM. Reason: RESOVED
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks