Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excel - vba - userform - frame - set scrollbar position

How do I set the scrollbar position of a frame(inside an userform)?

The case:

I have a frame in an userform that has dynamic content. So if the content is too big to fit the frame, it (dynamically) creates a scrollbar in that frame. The scrollbar also has dynamic values, following the frame content size.

The code that updates the scrollbar is as follows:

With userform1.frame1
    'dynamic size
    .ScrollHeight = param1 * param2
    .ScrollWidth = .InsideWidth * 30
End with

So I'd like to have something to send the scrollbar to the bottom position! How do I do that? Thanks in advance

like image 555
ramtoo Avatar asked Mar 04 '13 00:03

ramtoo


1 Answers

After setting the ScrollHeight and ScrollWidth and still inside the With block try:

.Scroll ActionX:=fmScrollActionNoChange, ActionY:=fmScrollActionEnd

More details can be found here

like image 92
barrowc Avatar answered Oct 06 '22 19:10

barrowc