Link to home
Start Free TrialLog in
Avatar of A G
A GFlag for United States of America

asked on

Scrollbar Position on VBA Excel Userform

When I open my userform , the horizontal scollbar starts form the middle of the page instead of the top. How can solve this problem?
thanks,
Avatar of harr22
harr22
Flag of United States of America image

set the default "value" property of the scroll bar to 0
Avatar of A G

ASKER

Ok, how do you do that in the code ?

With Me

ScrollBars = fmScrollBarsBoth
        .ScrollHeight = .InsideHeight * 1.2
        .ScrollWidth = .InsideWidth * 1.2
        .ScrollLeft = 3
        .ScrollTop = 2
   
End With
sorry, I thought you were refering to a scrollbar control that you had added to the form, not the scroll bar of the form itself.

Does it work like you want if you cange the left and top properties to 0?  Maybe Im confused with what you are asking.

        .ScrollLeft = 0
        .ScrollTop = 0
Avatar of A G

ASKER

No it doesnt work.
Ok so this is what happens.
WHen i open the userform. The scrollbar is scrolled to bottom. so It does not start from the top of the userform (bottom part is visible at first), because it is scrolled down to bottom.
ASKER CERTIFIED SOLUTION
Avatar of harr22
harr22
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rory Archibald
Which control on your form is first in the tab order? Is it one at the bottom?