+ Reply to Thread
Results 1 to 3 of 3

UserForm's Command button moves when using scrollbar

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    Montreal, Quebec, Cnada
    MS-Off Ver
    Office 365 MSO 64 bits (16.0.12130.20272)
    Posts
    7

    UserForm's Command button moves when using scrollbar

    Hi,

    In excel vba, I have a userform with a typical OK command button to which I dynamically add (from left to right) several textboxes. When the number of textboxes are such that their total width is superior to the width of the form, I activate the form's horizontal scroll bar and set the ScrollWidth so the textboxs can all be visible and/or accessed by the user using the horizontal scroll bar at the bottom of the userform. My only problem is that the OK command button also moves when I use the scroll bar.

    Is there any technics I could use, vba or otherwise, to freeze the command button position to a specific position on the userform while the user use the horizontal scrollbar ?

    Thank You very much for your help
    Sylvain
    Last edited by zsylvainz; 02-14-2020 at 10:37 PM.
    ZsylvainZ

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    8,764

    Re: UserForm's Command button moves when using scrollbar

    Add a Frame control to your userform with the Textboxes added inside the frame and the Command Button outside. The Frame can have its own horizontal scroll bar that won't affect anything outside.

    Scroll Bars in a Frame
    Last edited by AlphaFrog; 02-14-2020 at 11:53 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-09-2013
    Location
    Montreal, Quebec, Cnada
    MS-Off Ver
    Office 365 MSO 64 bits (16.0.12130.20272)
    Posts
    7

    Re: UserForm's Command button moves when using scrollbar

    lol why didn't I think of that, it's a great idea ! Thank you a thousand times. Much appreciated

    Sylvain

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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