+ Reply to Thread
Results 1 to 7 of 7

Scroll box problem in form

  1. #1
    Registered User
    Join Date
    01-16-2016
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    18

    Scroll box problem in form

    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

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Scroll box problem in form

    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.

  3. #3
    Registered User
    Join Date
    01-16-2016
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    18

    Re: Scroll box problem in form

    I have attached a copy. The add, reset and close buttons I have not been able to get to work iether

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Scroll box problem in form

    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.

  5. #5
    Registered User
    Join Date
    01-16-2016
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    18

    Re: Scroll box problem in form

    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.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Scroll box problem in form

    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.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-16-2016
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    18

    Re: RESOVED Scroll box problem in form

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Scroll Bar (Form Control)
    By cityinbetween in forum Excel General
    Replies: 3
    Last Post: 07-23-2014, 02:29 PM
  2. How to use a Scroll bar (form control)
    By RA_Lek in forum Excel General
    Replies: 2
    Last Post: 07-07-2013, 11:18 PM
  3. Scroll bar (Form Control) - Resetting the scroll bar to particular values
    By Vishb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2011, 04:10 AM
  4. using the scroll bar in a user form
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2009, 12:21 PM
  5. Scroll Bars in a form
    By dextras in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-04-2009, 06:30 AM
  6. [SOLVED] Zoom and Scroll Form
    By JEFF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 10:45 AM
  7. Scroll name in about-form for credit
    By ilyaskazi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2005, 08:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1